]> git.saurik.com Git - apple/configd.git/commitdiff
configd-395.6.tar.gz mac-os-x-107 mac-os-x-1071 v395.6
authorApple <opensource@apple.com>
Wed, 13 Jul 2011 00:06:38 +0000 (00:06 +0000)
committerApple <opensource@apple.com>
Wed, 13 Jul 2011 00:06:38 +0000 (00:06 +0000)
174 files changed:
Makefile [new file with mode: 0644]
Plugins/ATconfig/Info.plist [deleted file]
Plugins/ATconfig/atconfig.c [deleted file]
Plugins/ATconfig/cfManager.c [deleted file]
Plugins/ATconfig/cfManager.h [deleted file]
Plugins/IPMonitor/Info.plist
Plugins/IPMonitor/Makefile
Plugins/IPMonitor/dns-configuration.c
Plugins/IPMonitor/ip_plugin.c
Plugins/IPMonitor/proxy-configuration.c [new file with mode: 0644]
Plugins/IPMonitor/proxy-configuration.h [new file with mode: 0644]
Plugins/IPMonitor/set-hostname.c
Plugins/IPMonitor/smb-configuration.c
Plugins/InterfaceNamer/Info.plist
Plugins/InterfaceNamer/Makefile [new file with mode: 0644]
Plugins/InterfaceNamer/ifnamer.c
Plugins/KernelEventMonitor/Info.plist
Plugins/KernelEventMonitor/ev_appletalk.c [deleted file]
Plugins/KernelEventMonitor/ev_appletalk.h [deleted file]
Plugins/KernelEventMonitor/eventmon.c
Plugins/Kicker/Info.plist [deleted file]
Plugins/Kicker/Kicker.xml [deleted file]
Plugins/Kicker/enable-network [deleted file]
Plugins/Kicker/kicker.c [deleted file]
Plugins/LinkConfiguration/Info.plist
Plugins/LinkConfiguration/Makefile [new file with mode: 0644]
Plugins/LinkConfiguration/linkconfig.c
Plugins/Logger/Info-Embedded.plist
Plugins/Logger/Info.plist
Plugins/Logger/Makefile
Plugins/Logger/logger.c
Plugins/NetworkIdentification/Info.plist
Plugins/PreferencesMonitor/Info.plist
Plugins/PreferencesMonitor/prefsmon.c
SCMonitor/Info.plist
SCMonitor/monitor.c
SystemConfiguration.fproj/AppWorkaround.plist [new file with mode: 0644]
SystemConfiguration.fproj/BondConfiguration.c
SystemConfiguration.fproj/BridgeConfiguration.c [new file with mode: 0644]
SystemConfiguration.fproj/CaptiveNetwork.c [new file with mode: 0644]
SystemConfiguration.fproj/CaptiveNetwork.h [new file with mode: 0644]
SystemConfiguration.fproj/English.lproj/Localizable.strings
SystemConfiguration.fproj/English.lproj/NetworkInterface.strings
SystemConfiguration.fproj/Info-Embedded.plist
SystemConfiguration.fproj/Info.plist
SystemConfiguration.fproj/LinkConfiguration.c
SystemConfiguration.fproj/NetworkConfiguration.plist
SystemConfiguration.fproj/SCD.c
SystemConfiguration.fproj/SCDAdd.c
SystemConfiguration.fproj/SCDGet.c
SystemConfiguration.fproj/SCDKeys.c
SystemConfiguration.fproj/SCDList.c
SystemConfiguration.fproj/SCDLock.c
SystemConfiguration.fproj/SCDNotifierAdd.c
SystemConfiguration.fproj/SCDNotifierCancel.c
SystemConfiguration.fproj/SCDNotifierGetChanges.c
SystemConfiguration.fproj/SCDNotifierInformViaCallback.c
SystemConfiguration.fproj/SCDNotifierInformViaFD.c
SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c
SystemConfiguration.fproj/SCDNotifierInformViaSignal.c
SystemConfiguration.fproj/SCDNotifierRemove.c
SystemConfiguration.fproj/SCDNotifierSetKeys.c
SystemConfiguration.fproj/SCDNotifierWait.c
SystemConfiguration.fproj/SCDNotify.c
SystemConfiguration.fproj/SCDOpen.c
SystemConfiguration.fproj/SCDPlugin.c
SystemConfiguration.fproj/SCDPrivate.c
SystemConfiguration.fproj/SCDRemove.c
SystemConfiguration.fproj/SCDSet.c
SystemConfiguration.fproj/SCDSnapshot.c
SystemConfiguration.fproj/SCDTouch.c
SystemConfiguration.fproj/SCDUnlock.c
SystemConfiguration.fproj/SCDynamicStore.h
SystemConfiguration.fproj/SCDynamicStoreInternal.h
SystemConfiguration.fproj/SCDynamicStorePrivate.h
SystemConfiguration.fproj/SCLocation.c
SystemConfiguration.fproj/SCNetwork.h
SystemConfiguration.fproj/SCNetworkConfiguration.h
SystemConfiguration.fproj/SCNetworkConfigurationInternal.c
SystemConfiguration.fproj/SCNetworkConfigurationInternal.h
SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h
SystemConfiguration.fproj/SCNetworkConnection.c
SystemConfiguration.fproj/SCNetworkConnection.h
SystemConfiguration.fproj/SCNetworkConnectionPrivate.c
SystemConfiguration.fproj/SCNetworkConnectionPrivate.h
SystemConfiguration.fproj/SCNetworkInterface.c
SystemConfiguration.fproj/SCNetworkReachability.c
SystemConfiguration.fproj/SCNetworkReachability.h
SystemConfiguration.fproj/SCNetworkService.c
SystemConfiguration.fproj/SCNetworkSet.c
SystemConfiguration.fproj/SCNetworkSignature.c
SystemConfiguration.fproj/SCNetworkSignature.h
SystemConfiguration.fproj/SCNetworkSignaturePrivate.h
SystemConfiguration.fproj/SCP.c
SystemConfiguration.fproj/SCPApply.c
SystemConfiguration.fproj/SCPCommit.c
SystemConfiguration.fproj/SCPLock.c
SystemConfiguration.fproj/SCPOpen.c
SystemConfiguration.fproj/SCPPath.c
SystemConfiguration.fproj/SCPRemove.c
SystemConfiguration.fproj/SCPUnlock.c
SystemConfiguration.fproj/SCPreferences.h
SystemConfiguration.fproj/SCPreferencesInternal.h
SystemConfiguration.fproj/SCPreferencesKeychainPrivate.c
SystemConfiguration.fproj/SCPreferencesPathKey.c
SystemConfiguration.fproj/SCPreferencesPrivate.h
SystemConfiguration.fproj/SCPreferencesSetSpecific.h
SystemConfiguration.fproj/SCPrivate.h
SystemConfiguration.fproj/SCProxies.c
SystemConfiguration.fproj/SCSchemaDefinitions.c
SystemConfiguration.fproj/SCSchemaDefinitions.h
SystemConfiguration.fproj/SCSchemaDefinitionsPrivate.h
SystemConfiguration.fproj/SystemConfiguration.h
SystemConfiguration.fproj/VLANConfiguration.c
SystemConfiguration.fproj/VPNConfiguration.c [new file with mode: 0644]
SystemConfiguration.fproj/VPNConfiguration.h [new file with mode: 0644]
SystemConfiguration.fproj/VPNPrivate.c [new file with mode: 0644]
SystemConfiguration.fproj/VPNPrivate.h [new file with mode: 0644]
SystemConfiguration.fproj/VPNTunnel.c [new file with mode: 0644]
SystemConfiguration.fproj/VPNTunnel.h [new file with mode: 0644]
SystemConfiguration.fproj/VPNTunnelPrivate.h [new file with mode: 0644]
SystemConfiguration.fproj/dy_framework.c
SystemConfiguration.fproj/dy_framework.h
SystemConfiguration.fproj/genSCPreferences.c
SystemConfiguration.fproj/helper/SCHelper_client.c
SystemConfiguration.fproj/helper/SCHelper_client.h
SystemConfiguration.fproj/helper/SCHelper_server.c
SystemConfiguration.fproj/helper/com.apple.SCHelper-embedded.plist
SystemConfiguration.fproj/helper/com.apple.SCHelper.plist
SystemConfiguration.fproj/helper/helper.defs [new file with mode: 0644]
SystemConfiguration.fproj/helper/helper_comm.c [deleted file]
SystemConfiguration.fproj/helper/helper_comm.h [deleted file]
SystemConfiguration.fproj/helper/helper_types.h [new file with mode: 0644]
SystemConfiguration.fproj/update-headers
configd.tproj/_configclose.c
configd.tproj/_notifyadd.c
configd.tproj/_notifyremove.c
configd.tproj/_notifyviafd.c
configd.tproj/_snapshot.c
configd.tproj/com.apple.configd.plist
configd.tproj/configd.8
configd.tproj/configd.m
configd.tproj/configd_server.c
configd.tproj/entitlements.plist
configd.tproj/pattern.c
configd.tproj/plugin_support.c
configd.tproj/session.c
configd.tproj/session.h
configd.xcodeproj/project.pbxproj
dnsinfo/dnsinfo.h
dnsinfo/dnsinfo_copy.c
dnsinfo/dnsinfo_create.c
dnsinfo/dnsinfo_create.h
dnsinfo/dnsinfo_flatfile.c
dnsinfo/dnsinfo_private.c
dnsinfo/dnsinfo_private.h
get-mobility-info
scselect.tproj/scselect.c
scutil.tproj/commands.c
scutil.tproj/dictionary.c
scutil.tproj/nc.c [new file with mode: 0644]
scutil.tproj/nc.h [new file with mode: 0644]
scutil.tproj/net.c
scutil.tproj/net_interface.c
scutil.tproj/net_protocol.c
scutil.tproj/net_service.c
scutil.tproj/net_service.h
scutil.tproj/net_set.c
scutil.tproj/notifications.c
scutil.tproj/prefs.c
scutil.tproj/scutil.c
scutil.tproj/scutil.h
scutil.tproj/session.c
scutil.tproj/tests.c

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..d65e129
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+#----------------------------------------------------------------------
+#
+# Build for [current] release
+#
+#----------------------------------------------------------------------
+
+all :
+       /usr/local/bin/buildit .                                \
+         -noinstallsrc -noinstallhdrs -noverify -nosum         \
+         -arch i386 -arch x86_64 -arch ppc                     \
+         -target All                                           \
+         -project configd                                      \
+         -configuration Debug                                  \
+         -release $(shell cat /usr/share/buildit/.releaseName) \
+
+#----------------------------------------------------------------------
+#
+# Build for SnowLeopard, SUSnowXXX, ...
+#
+# Note: assumes that the "pppcontroller_sendmsg" routine has been defined
+#       in pppcontroller.defs.
+#
+#----------------------------------------------------------------------
+
+PROJECT=$(shell basename `pwd -P`)
+
+SNOW_CFLAGS += -D__MAC_10_7=1060
+SNOW_CFLAGS += -D__AVAILABILITY_INTERNAL__MAC_10_7=__AVAILABILITY_INTERNAL__MAC_10_6
+SNOW_CFLAGS += -D__AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_7=__AVAILABILITY_INTERNAL__MAC_10_5
+#SNOW_CFLAGS += -DHAVE_PPPCONTROLLER_SENDMSG=YES
+
+snow :
+       /usr/local/bin/buildit .                                \
+         -noinstallsrc -noinstallhdrs -noverify -nosum         \
+         -arch i386 -arch x86_64 -arch ppc                     \
+         -target All                                           \
+         -project ${PROJECT}                                   \
+         -configuration Debug                                  \
+         -release $(shell cat /usr/share/buildit/.releaseName) \
+         -othercflags "\"$(SNOW_CFLAGS)\""                     \
+
diff --git a/Plugins/ATconfig/Info.plist b/Plugins/ATconfig/Info.plist
deleted file mode 100644 (file)
index e4ecc0a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>CFBundleDevelopmentRegion</key>
-       <string>English</string>
-       <key>CFBundleExecutable</key>
-       <string>ATconfig</string>
-       <key>CFBundleIdentifier</key>
-       <string>com.apple.SystemConfiguration.ATconfig</string>
-       <key>CFBundleInfoDictionaryVersion</key>
-       <string>6.0</string>
-       <key>CFBundleName</key>
-       <string>com.apple.SystemConfiguration.ATconfig</string>
-       <key>CFBundlePackageType</key>
-       <string>BNDL</string>
-       <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
-       <key>CFBundleSignature</key>
-       <string>????</string>
-       <key>CFBundleVersion</key>
-       <string>1.10.2</string>
-       <key>Builtin</key>
-       <true/>
-       <key>Requires</key>
-       <array>
-               <string>com.apple.SystemConfiguration.InterfaceNamer</string>
-               <string>com.apple.SystemConfiguration.KernelEventMonitor</string>
-               <string>com.apple.SystemConfiguration.PreferencesMonitor</string>
-       </array>
-</dict>
-</plist>
diff --git a/Plugins/ATconfig/atconfig.c b/Plugins/ATconfig/atconfig.c
deleted file mode 100644 (file)
index 9f0d405..0000000
+++ /dev/null
@@ -1,1630 +0,0 @@
-/*
- * Copyright (c) 2000-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@
- */
-
-/*
- * Modification History
- *
- * March 15, 2003              Allan Nathanson <ajn@apple.com>
- * - startup/shutdown AT networking without Kicker's help and
- *   publish the state information after the configuration is
- *   active.
- *
- * April 29, 2002              Allan Nathanson <ajn@apple.com>
- * - add global state information (primary service, interface)
- *
- * June 24, 2001               Allan Nathanson <ajn@apple.com>
- * - update to public SystemConfiguration.framework APIs
- *
- * July 7, 2000                        Allan Nathanson <ajn@apple.com>
- * - initial revision
- */
-
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <dlfcn.h>
-#include <net/if.h>
-#include <netat/appletalk.h>
-#include <netat/at_var.h>
-#include <AppleTalk/at_paths.h>
-#include <AppleTalk/at_proto.h>
-
-#include <CoreFoundation/CoreFoundation.h>
-#include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCPrivate.h>
-#include <SystemConfiguration/SCDPlugin.h>
-#include <SystemConfiguration/SCValidation.h>
-
-#include "cache.h"
-#include "cfManager.h"
-
-#define HOSTCONFIG     "/etc/hostconfig"
-
-static SCDynamicStoreRef       store           = NULL;
-static CFRunLoopSourceRef      storeRls        = NULL;
-
-static int                     curState        = 0;    // abs(state) == sequence #, < 0 == stop, > 0 == start
-static CFMutableDictionaryRef  curGlobals      = NULL;
-static CFMutableArrayRef       curConfigFile   = NULL;
-static CFMutableDictionaryRef  curDefaults     = NULL;
-static CFMutableDictionaryRef  curStartup      = NULL;
-
-static Boolean                 _verbose        = FALSE;
-
-
-#define        RETRY_DELAY     2.0     // seconds
-#define        RETRY_LIMIT     5       // # of startup/shutdown attempts
-
-static void    startAppleTalk(CFRunLoopTimerRef timer, void *info);
-static void    stopAppleTalk (CFRunLoopTimerRef timer, void *info);
-
-
-static void *
-__loadAppleTalk(void) {
-       static void *image = NULL;
-       if (NULL == image) {
-               const char      *framework              = "/System/Library/Frameworks/AppleTalk.framework/Versions/A/AppleTalk";
-               struct stat     statbuf;
-               const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
-               char            path[MAXPATHLEN];
-
-               strlcpy(path, framework, sizeof(path));
-               if (suffix) strlcat(path, suffix, sizeof(path));
-               if (0 <= stat(path, &statbuf)) {
-                       image = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
-               } else {
-                       image = dlopen(framework, RTLD_LAZY | RTLD_LOCAL);
-               }
-       }
-       return (void *)image;
-}
-
-
-static int
-_at_setdefaultaddr(char *ifName, struct at_addr *init_address)
-{
-       #undef at_setdefaultaddr
-       static typeof (at_setdefaultaddr) *dyfunc = NULL;
-       if (!dyfunc) {
-               void *image = __loadAppleTalk();
-               if (image) dyfunc = dlsym(image, "at_setdefaultaddr");
-       }
-       return dyfunc ? dyfunc(ifName, init_address) : -1;
-}
-#define at_setdefaultaddr _at_setdefaultaddr
-
-
-static int
-_at_setdefaultzone(char *ifName, at_nvestr_t *zone)
-{
-       #undef at_setdefaultzone
-       static typeof (at_setdefaultzone) *dyfunc = NULL;
-       if (!dyfunc) {
-               void *image = __loadAppleTalk();
-               if (image) dyfunc = dlsym(image, "at_setdefaultzone");
-       }
-       return dyfunc ? dyfunc(ifName, zone) : -1;
-}
-#define at_setdefaultzone _at_setdefaultzone
-
-
-static void
-updateDefaults(const void *key, const void *val, void *context)
-{
-       CFStringRef             ifName          = (CFStringRef)key;
-       CFDictionaryRef         oldDict;
-       CFDictionaryRef         newDict         = (CFDictionaryRef)val;
-       CFNumberRef             defaultNode;
-       CFNumberRef             defaultNetwork;
-       CFStringRef             defaultZone;
-
-       if (!CFDictionaryGetValueIfPresent(curDefaults, ifName, (const void **)&oldDict) ||
-           !CFEqual(oldDict, newDict)) {
-               char            ifr_name[IFNAMSIZ + 1];
-
-               bzero(&ifr_name, sizeof(ifr_name));
-               if (!_SC_cfstring_to_cstring(ifName, ifr_name, sizeof(ifr_name), kCFStringEncodingASCII)) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("could not convert interface name to C string"));
-                       return;
-               }
-
-               /*
-                * Set preferred Network and Node ID
-                */
-               if (CFDictionaryGetValueIfPresent(newDict,
-                                                 kSCPropNetAppleTalkNetworkID,
-                                                 (const void **)&defaultNetwork) &&
-                   CFDictionaryGetValueIfPresent(newDict,
-                                                 kSCPropNetAppleTalkNodeID,
-                                                 (const void **)&defaultNode)
-                   ) {
-                       struct at_addr  init_address;
-                       int             status;
-
-                       /*
-                        * set the default node and network
-                        */
-                       CFNumberGetValue(defaultNetwork, kCFNumberShortType, &init_address.s_net);
-                       CFNumberGetValue(defaultNode,    kCFNumberCharType,  &init_address.s_node);
-                       status = at_setdefaultaddr(ifr_name, &init_address);
-                       if (status == -1) {
-                               SCLog(TRUE, LOG_ERR, CFSTR("at_setdefaultaddr() failed"));
-                               return;
-                       }
-               }
-
-               /*
-                * Set default zone
-                */
-               if (CFDictionaryGetValueIfPresent(newDict,
-                                                 kSCPropNetAppleTalkDefaultZone,
-                                                 (const void **)&defaultZone)
-                   ) {
-                       int             status;
-                       at_nvestr_t     zone;
-
-                       /*
-                        * set the "default zone" for this interface
-                        */
-                       bzero(&zone, sizeof(zone));
-                       if (!_SC_cfstring_to_cstring(defaultZone,
-                                                    (char *)zone.str,
-                                                    sizeof(zone.str),
-                                                    kCFStringEncodingASCII)) {
-                               SCLog(TRUE, LOG_ERR, CFSTR("could not convert default zone to C string"));
-                               return;
-                       }
-
-                       zone.len = strlen((const char *)zone.str);
-                       status = at_setdefaultzone(ifr_name, &zone);
-                       if (status == -1) {
-                               SCLog(TRUE, LOG_ERR, CFSTR("at_setdefaultzone() failed"));
-                               return;
-                       }
-               }
-       }
-
-       return;
-}
-
-
-static void
-addZoneToPorts(const void *key, const void *val, void *context)
-{
-       CFStringRef             zone            = (CFStringRef)key;
-       CFArrayRef              ifArray         = (CFArrayRef)val;
-       CFMutableArrayRef       zones           = (CFMutableArrayRef)context;
-       CFStringRef             ifList;
-       CFStringRef             configInfo;
-
-       ifList = CFStringCreateByCombiningStrings(NULL, ifArray, CFSTR(":"));
-       configInfo = CFStringCreateWithFormat(NULL, NULL, CFSTR(":%@:%@"), zone, ifList);
-       CFArrayAppendValue(zones, configInfo);
-       CFRelease(configInfo);
-       CFRelease(ifList);
-       return;
-}
-
-
-/*
- * 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);
-       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 CFDictionaryRef
-entity_one(SCDynamicStoreRef store, CFStringRef key)
-{
-       CFDictionaryRef         ent_dict        = NULL;
-       CFDictionaryRef         if_dict         = NULL;
-       CFStringRef             if_key          = NULL;
-       CFStringRef             if_port;
-       CFMutableDictionaryRef  new_dict        = NULL;
-       static CFStringRef      pre             = NULL;
-       CFStringRef             serviceID       = NULL;
-       CFStringRef             serviceType;
-
-       if (!pre) {
-               pre = SCDynamicStoreKeyCreate(NULL,
-                                             CFSTR("%@/%@/%@/"),
-                                             kSCDynamicStoreDomainSetup,
-                                             kSCCompNetwork,
-                                             kSCCompService);
-       }
-
-       /*
-        * get entity dictionary for service
-        */
-       ent_dict = cache_SCDynamicStoreCopyValue(store, key);
-       if (!isA_CFDictionary(ent_dict)) {
-               goto done;
-       }
-
-       /*
-        * get interface dictionary for service
-        */
-       serviceID = parse_component(key, pre);
-       if (!serviceID) {
-               goto done;
-       }
-
-       if_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                            kSCDynamicStoreDomainSetup,
-                                                            serviceID,
-                                                            kSCEntNetInterface);
-       if_dict = cache_SCDynamicStoreCopyValue(store, if_key);
-       CFRelease(if_key);
-       if (!isA_CFDictionary(if_dict)) {
-               goto done;
-       }
-
-       /* check the interface type */
-       serviceType = CFDictionaryGetValue(if_dict,
-                                          kSCPropNetInterfaceType);
-       if (!isA_CFString(serviceType) ||
-           !CFEqual(serviceType, kSCValNetInterfaceTypeEthernet)) {
-               /* sorry, no AT networking on this interface */
-               goto done;
-       }
-
-       /*
-        * get port name (from interface dictionary).
-        */
-       if_port = CFDictionaryGetValue(if_dict, kSCPropNetInterfaceDeviceName);
-       if (!isA_CFString(if_port)) {
-               goto done;
-       }
-
-       /*
-        * add ServiceID and interface port name to entity dictionary.
-        */
-       new_dict = CFDictionaryCreateMutableCopy(NULL, 0, ent_dict);
-       CFDictionarySetValue(new_dict, CFSTR("ServiceID"), serviceID);
-       CFDictionarySetValue(new_dict, kSCPropNetInterfaceDeviceName, if_port);
-
-    done:
-
-       if (ent_dict)   CFRelease(ent_dict);
-       if (if_dict)    CFRelease(if_dict);
-       if (serviceID)  CFRelease(serviceID);
-       return (CFDictionaryRef)new_dict;
-}
-
-
-static CFArrayRef
-entity_all(SCDynamicStoreRef store, CFStringRef entity, CFArrayRef order)
-{
-       CFMutableArrayRef       defined = NULL;
-       CFIndex                 i;
-       CFIndex                 n;
-       CFMutableArrayRef       ordered = NULL;
-       CFStringRef             pattern;
-
-       ordered = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-
-       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                             kSCDynamicStoreDomainSetup,
-                                                             kSCCompAnyRegex,
-                                                             entity);
-       defined = (CFMutableArrayRef)SCDynamicStoreCopyKeyList(store, pattern);
-       CFRelease(pattern);
-       if (defined && (CFArrayGetCount(defined) > 0)) {
-               CFArrayRef      tmp;
-
-               tmp = defined;
-               defined = CFArrayCreateMutableCopy(NULL, 0, tmp);
-               CFRelease(tmp);
-       } else {
-               goto done;
-       }
-
-       n = order ? CFArrayGetCount(order) : 0;
-       for (i = 0; i < n; i++) {
-               CFDictionaryRef dict;
-               CFStringRef     key;
-               CFIndex         j;
-               CFStringRef     service;
-
-               service = CFArrayGetValueAtIndex(order, i);
-               if (!isA_CFString(service)) {
-                       continue;
-               }
-
-               key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                                 kSCDynamicStoreDomainSetup,
-                                                                 service,
-                                                                 entity);
-               dict = entity_one(store, key);
-               if (dict) {
-                       CFArrayAppendValue(ordered, dict);
-                       CFRelease(dict);
-               }
-
-               j = CFArrayGetFirstIndexOfValue(defined,
-                                               CFRangeMake(0, CFArrayGetCount(defined)),
-                                               key);
-               if (j != kCFNotFound) {
-                       CFArrayRemoveValueAtIndex(defined, j);
-               }
-
-               CFRelease(key);
-       }
-
-       n = CFArrayGetCount(defined);
-       for (i = 0; i < n; i++) {
-               CFDictionaryRef dict;
-               CFStringRef     key;
-
-               key  = CFArrayGetValueAtIndex(defined, i);
-               dict = entity_one(store, key);
-               if (dict) {
-                       CFArrayAppendValue(ordered, dict);
-                       CFRelease(dict);
-               }
-       }
-
-    done:
-
-       if (defined)    CFRelease(defined);
-       if (CFArrayGetCount(ordered) == 0) {
-               CFRelease(ordered);
-               ordered = NULL;
-       }
-       return ordered;
-}
-
-
-static void
-encodeName(CFStringRef                 name,
-          CFStringEncoding             encoding,
-          CFMutableDictionaryRef       startup,
-          CFMutableDictionaryRef       globals)
-{
-       CFDataRef               bytes;
-       CFMutableStringRef      encodedName = NULL;
-       CFIndex                 len;
-
-       if (!isA_CFString(name)) {
-               return;
-       }
-
-       if (encoding == kCFStringEncodingASCII) {
-               encodedName = (CFMutableStringRef)CFStringCreateCopy(NULL, name);
-               goto done;
-       }
-
-       /*
-        * encode the potentially non-printable string
-        */
-       bytes = CFStringCreateExternalRepresentation(NULL,
-                                                    name,
-                                                    encoding,
-                                                    0);
-       if (bytes) {
-               unsigned char   *byte;
-               CFIndex         i;
-
-               /*
-                * check if the MacRoman string can be represented as ASCII
-                */
-               if (encoding == kCFStringEncodingMacRoman) {
-                       CFDataRef       ascii;
-
-                       ascii = CFStringCreateExternalRepresentation(NULL,
-                                                                    name,
-                                                                    kCFStringEncodingASCII,
-                                                                    0);
-                       if (ascii) {
-                               CFRelease(ascii);
-                               CFRelease(bytes);
-                               encodedName = (CFMutableStringRef)CFStringCreateCopy(NULL, name);
-                               goto done;
-                       }
-               }
-
-               encodedName = CFStringCreateMutable(NULL, 0);
-
-               len  = CFDataGetLength(bytes);
-               byte = (unsigned char *)CFDataGetBytePtr(bytes);
-               for (i = 0; i < len; i++, byte++) {
-                       CFStringAppendFormat(encodedName,
-                                            NULL,
-                                            CFSTR("%02x"),
-                                            *byte);
-               }
-
-               /*
-                * add "encoded string" markers
-                */
-               CFStringInsert(encodedName, 0, CFSTR("*"));
-               CFStringAppend(encodedName,    CFSTR("*"));
-
-               CFRelease(bytes);
-       }
-
-    done :
-
-       if (encodedName) {
-               if (startup) {
-                       /* update "startup" dictionary */
-                       CFDictionaryAddValue(startup, CFSTR("APPLETALK_HOSTNAME"), encodedName);
-               }
-
-               if (globals) {
-                       CFNumberRef     num;
-
-                       /* update "global" dictionary */
-                       num = CFNumberCreate(NULL, kCFNumberIntType, &encoding);
-                       CFDictionaryAddValue(globals, kSCPropNetAppleTalkComputerName,         name);
-                       CFDictionaryAddValue(globals, kSCPropNetAppleTalkComputerNameEncoding, num);
-                       CFRelease(num);
-               }
-
-               CFRelease(encodedName);
-       }
-
-       return;
-}
-
-
-static boolean_t
-updateConfiguration(int *newState)
-{
-       boolean_t               changed                 = FALSE;
-       CFStringRef             computerName;
-       CFStringEncoding        computerNameEncoding;
-       CFArrayRef              configuredServices      = NULL;
-       CFDictionaryRef         dict;
-       CFIndex                 i;
-       CFIndex                 ifCount                 = 0;
-       CFMutableArrayRef       info                    = NULL;
-       CFArrayRef              interfaces              = NULL;
-       CFStringRef             key;
-       CFArrayRef              keys;
-       CFIndex                 n;
-       CFMutableArrayRef       newConfigFile;
-       CFMutableDictionaryRef  newDefaults;
-       CFMutableDictionaryRef  newDict;
-       CFMutableDictionaryRef  newGlobals;
-       CFMutableDictionaryRef  newGlobalsX;                    /* newGlobals without ServiceID */
-       CFMutableDictionaryRef  newStartup;
-       CFMutableDictionaryRef  newZones;
-       CFNumberRef             num;
-       CFMutableDictionaryRef  curGlobalsX;                    /* curGlobals without ServiceID */
-       CFStringRef             pattern;
-       boolean_t               postGlobals             = FALSE;
-       CFStringRef             primaryPort             = NULL; /* primary interface */
-       CFStringRef             primaryZone             = NULL;
-       CFArrayRef              serviceOrder            = NULL;
-       CFDictionaryRef         setGlobals              = NULL;
-
-       cache_open();
-
-       /*
-        * establish the "new" AppleTalk configuration
-        */
-       *newState     = curState;
-       newConfigFile = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-       newGlobals    = CFDictionaryCreateMutable(NULL,
-                                                 0,
-                                                 &kCFTypeDictionaryKeyCallBacks,
-                                                 &kCFTypeDictionaryValueCallBacks);
-       newDefaults   = CFDictionaryCreateMutable(NULL,
-                                                 0,
-                                                 &kCFTypeDictionaryKeyCallBacks,
-                                                 &kCFTypeDictionaryValueCallBacks);
-       newStartup    = CFDictionaryCreateMutable(NULL,
-                                                 0,
-                                                 &kCFTypeDictionaryKeyCallBacks,
-                                                 &kCFTypeDictionaryValueCallBacks);
-       newZones      = CFDictionaryCreateMutable(NULL,
-                                                 0,
-                                                 &kCFTypeDictionaryKeyCallBacks,
-                                                 &kCFTypeDictionaryValueCallBacks);
-
-       /* initialize overall state */
-       CFDictionarySetValue(newStartup, CFSTR("APPLETALK"), CFSTR("-NO-"));
-
-       /*
-        * get the global settings (ServiceOrder, ComputerName, ...)
-        */
-       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
-                                                        kSCDynamicStoreDomainSetup,
-                                                        kSCEntNetAppleTalk);
-       setGlobals = cache_SCDynamicStoreCopyValue(store, key);
-       CFRelease(key);
-       if (setGlobals) {
-               if (isA_CFDictionary(setGlobals)) {
-                       /* get service order */
-                       serviceOrder = CFDictionaryGetValue(setGlobals,
-                                                           kSCPropNetServiceOrder);
-                       serviceOrder = isA_CFArray(serviceOrder);
-                       if (serviceOrder) {
-                               CFRetain(serviceOrder);
-                       }
-               } else {
-                       CFRelease(setGlobals);
-                       setGlobals = NULL;
-               }
-       }
-
-       /*
-        * if we don't have an AppleTalk ServiceOrder, use IPv4's (if defined)
-        */
-       if (!serviceOrder) {
-               key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
-                                                                kSCDynamicStoreDomainSetup,
-                                                                kSCEntNetIPv4);
-               dict = cache_SCDynamicStoreCopyValue(store, key);
-               CFRelease(key);
-               if (dict) {
-                       if (isA_CFDictionary(dict)) {
-                               serviceOrder = CFDictionaryGetValue(dict,
-                                                                   kSCPropNetServiceOrder);
-                               serviceOrder = isA_CFArray(serviceOrder);
-                               if (serviceOrder) {
-                                       CFRetain(serviceOrder);
-                               }
-                       }
-                       CFRelease(dict);
-               }
-       }
-
-       /*
-        * get the list of ALL configured services
-        */
-       configuredServices = entity_all(store, kSCEntNetAppleTalk, serviceOrder);
-       if (configuredServices) {
-               ifCount = CFArrayGetCount(configuredServices);
-       }
-
-       if (serviceOrder)       CFRelease(serviceOrder);
-
-       /*
-        * get the list of ALL active interfaces
-        */
-       key  = SCDynamicStoreKeyCreateNetworkInterface(NULL, kSCDynamicStoreDomainState);
-       dict = cache_SCDynamicStoreCopyValue(store, key);
-       CFRelease(key);
-       if (dict) {
-               if (isA_CFDictionary(dict)) {
-                       interfaces = CFDictionaryGetValue(dict,
-                                                         kSCDynamicStorePropNetInterfaces);
-                       interfaces = isA_CFArray(interfaces);
-                       if (interfaces) {
-                               CFRetain(interfaces);
-                       }
-               }
-               CFRelease(dict);
-       }
-
-       /*
-        * get the list of previously configured services
-        */
-       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                             kSCDynamicStoreDomainState,
-                                                             kSCCompAnyRegex,
-                                                             kSCEntNetAppleTalk);
-       keys = SCDynamicStoreCopyKeyList(store, pattern);
-       CFRelease(pattern);
-       if (keys) {
-               info = CFArrayCreateMutableCopy(NULL, 0, keys);
-               CFRelease(keys);
-       }
-
-       /*
-        * iterate over each configured service to establish the new
-        * configuration.
-        */
-       for (i = 0; i < ifCount; i++) {
-               CFDictionaryRef         service;
-               CFStringRef             ifName;
-               CFStringRef             configMethod;
-               CFMutableStringRef      portConfig      = NULL;
-               CFArrayRef              networkRange;   /* for seed ports, CFArray[2] of CFNumber (lo, hi) */
-               int                     sNetwork;
-               int                     eNetwork;
-               CFArrayRef              zoneList;       /* for seed ports, CFArray[] of CFString (zones names) */
-               CFIndex                 zCount;
-               CFIndex                 j;
-               CFMutableDictionaryRef  ifDefaults      = NULL;
-               CFNumberRef             defaultNetwork;
-               CFNumberRef             defaultNode;
-               CFStringRef             defaultZone;
-
-               /* get AppleTalk service dictionary */
-               service = CFArrayGetValueAtIndex(configuredServices, i);
-
-               /* get interface name */
-               ifName  = CFDictionaryGetValue(service, kSCPropNetInterfaceDeviceName);
-
-               /* check inteface availability */
-               if (!interfaces ||
-                   !CFArrayContainsValue(interfaces, CFRangeMake(0, CFArrayGetCount(interfaces)), ifName)) {
-                       /* if interface not available */
-                       goto nextIF;
-               }
-
-               /* check interface link status */
-               key = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                                   kSCDynamicStoreDomainState,
-                                                                   ifName,
-                                                                   kSCEntNetLink);
-               dict = cache_SCDynamicStoreCopyValue(store, key);
-               CFRelease(key);
-               if (dict) {
-                       Boolean linkStatus      = TRUE;  /* assume the link is "up" */
-                       Boolean ifDetaching     = FALSE; /* assume link is not detaching */
-
-                       /* the link key for this interface is available */
-                       if (isA_CFDictionary(dict)) {
-                               CFBooleanRef    bVal;
-
-                               bVal = CFDictionaryGetValue(dict, kSCPropNetLinkActive);
-                               if (isA_CFBoolean(bVal)) {
-                                       linkStatus = CFBooleanGetValue(bVal);
-                               }
-
-                               /* check if interface is detaching - value
-                                  doesn't really matter, only that it exists */
-                               ifDetaching = CFDictionaryContainsKey(dict, kSCPropNetLinkDetaching);
-                       }
-                       CFRelease(dict);
-
-                       if (!linkStatus || ifDetaching) {
-                               /* if link status down or the interface is detaching */
-                               goto nextIF;
-                       }
-               }
-
-               /*
-                * Determine configuration method for this service
-                */
-               configMethod = CFDictionaryGetValue(service, kSCPropNetAppleTalkConfigMethod);
-               if (!isA_CFString(configMethod)) {
-                       /* if no ConfigMethod */
-                       goto nextIF;
-               }
-
-               if (!CFEqual(configMethod, kSCValNetAppleTalkConfigMethodNode      ) &&
-                   !CFEqual(configMethod, kSCValNetAppleTalkConfigMethodRouter    ) &&
-                   !CFEqual(configMethod, kSCValNetAppleTalkConfigMethodSeedRouter)) {
-                       /* if not one of the expected values, disable */
-                       SCLog(TRUE, LOG_NOTICE,
-                             CFSTR("Unexpected AppleTalk ConfigMethod: %@"),
-                             configMethod);
-                       goto nextIF;
-               }
-
-               /*
-                * the first service to be defined will always be "primary"
-                */
-               if (CFArrayGetCount(newConfigFile) == 0) {
-                       CFDictionaryRef active;
-
-                       CFDictionarySetValue(newGlobals,
-                                            kSCDynamicStorePropNetPrimaryService,
-                                            CFDictionaryGetValue(service, CFSTR("ServiceID")));
-                       CFDictionarySetValue(newGlobals,
-                                            kSCDynamicStorePropNetPrimaryInterface,
-                                            ifName);
-
-                       /* and check if AT newtorking is active on the primary interface */
-                       key = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                                           kSCDynamicStoreDomainState,
-                                                                           ifName,
-                                                                           kSCEntNetAppleTalk);
-                       active = cache_SCDynamicStoreCopyValue(store, key);
-                       CFRelease(key);
-                       if (active) {
-                               if (isA_CFDictionary(active)) {
-                                       postGlobals = TRUE;
-                               }
-                               CFRelease(active);
-                       }
-               }
-
-               /*
-                * define the port
-                */
-               portConfig = CFStringCreateMutable(NULL, 0);
-               CFStringAppendFormat(portConfig, NULL, CFSTR("%@:"), ifName);
-
-               if (CFEqual(configMethod, kSCValNetAppleTalkConfigMethodSeedRouter)) {
-                       CFNumberRef     num;
-
-                       /*
-                        * we have been asked to configure this interface as a
-                        * seed port. Ensure that we have been provided at least
-                        * one network number, have been provided with at least
-                        * one zonename, ...
-                        */
-
-                       networkRange = CFDictionaryGetValue(service,
-                                                           kSCPropNetAppleTalkSeedNetworkRange);
-                       if (!isA_CFArray(networkRange) || (CFArrayGetCount(networkRange) == 0)) {
-                               SCLog(TRUE, LOG_NOTICE,
-                                     CFSTR("AppleTalk configuration error (%@)"),
-                                     kSCPropNetAppleTalkSeedNetworkRange);
-                               goto nextIF;
-                       }
-
-                       /*
-                        * establish the starting and ending network numbers
-                        */
-                       num = CFArrayGetValueAtIndex(networkRange, 0);
-                       if (!isA_CFNumber(num)) {
-                               SCLog(TRUE, LOG_NOTICE,
-                                     CFSTR("AppleTalk configuration error (%@)"),
-                                     kSCPropNetAppleTalkSeedNetworkRange);
-                               goto nextIF;
-                       }
-                       CFNumberGetValue(num, kCFNumberIntType, &sNetwork);
-                       eNetwork = sNetwork;
-
-                       if (CFArrayGetCount(networkRange) > 1) {
-                               num = CFArrayGetValueAtIndex(networkRange, 1);
-                               if (!isA_CFNumber(num)) {
-                                       SCLog(TRUE, LOG_NOTICE,
-                                             CFSTR("AppleTalk configuration error (%@)"),
-                                             kSCPropNetAppleTalkSeedNetworkRange);
-                                       goto nextIF;
-                               }
-                               CFNumberGetValue(num, kCFNumberIntType, &eNetwork);
-                       }
-                       CFStringAppendFormat(portConfig, NULL, CFSTR("%d:%d:"), sNetwork, eNetwork);
-
-                       /*
-                        * establish the zones associated with this port
-                        */
-                       zoneList = CFDictionaryGetValue(service,
-                                                       kSCPropNetAppleTalkSeedZones);
-                       if (!isA_CFArray(zoneList)) {
-                               SCLog(TRUE, LOG_NOTICE,
-                                     CFSTR("AppleTalk configuration error (%@)"),
-                                     kSCPropNetAppleTalkSeedZones);
-                               goto nextIF;
-                       }
-
-                       zCount = CFArrayGetCount(zoneList);
-                       for (j = 0; j < zCount; j++) {
-                               CFStringRef             zone;
-                               CFArrayRef              ifList;
-                               CFMutableArrayRef       newIFList;
-
-                               zone = CFArrayGetValueAtIndex(zoneList, j);
-                               if (!isA_CFString(zone)) {
-                                       continue;
-                               }
-
-                               if (CFDictionaryGetValueIfPresent(newZones, zone, (const void **)&ifList)) {
-                                       /* known zone */
-                                       newIFList = CFArrayCreateMutableCopy(NULL, 0, ifList);
-                               } else {
-                                       /* new zone */
-                                       newIFList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-                               }
-                               CFArrayAppendValue(newIFList, ifName);
-                               CFArraySortValues(newIFList,
-                                                 CFRangeMake(0, CFArrayGetCount(newIFList)),
-                                                 (CFComparatorFunction)CFStringCompare,
-                                                 NULL);
-                               CFDictionarySetValue(newZones, zone, newIFList);
-                               CFRelease(newIFList);
-
-                               /*
-                                * flag the default zone
-                                */
-                               if (!primaryZone) {
-                                       primaryZone = CFRetain(zone);
-                               }
-                       }
-                       if (!primaryZone) {
-                               SCLog(TRUE, LOG_NOTICE,
-                                     CFSTR("AppleTalk configuration error (%@)"),
-                                     kSCPropNetAppleTalkSeedZones);
-                               goto nextIF;
-                       }
-               }
-
-               /* get the (per-interface) "Computer Name" */
-               computerName = CFDictionaryGetValue(service,
-                                                   kSCPropNetAppleTalkComputerName);
-               if (CFDictionaryGetValueIfPresent(service,
-                                                 kSCPropNetAppleTalkComputerNameEncoding,
-                                                 (const void **)&num) &&
-                   isA_CFNumber(num)) {
-                       CFNumberGetValue(num, kCFNumberIntType, &computerNameEncoding);
-               } else {
-                       computerNameEncoding = CFStringGetSystemEncoding();
-               }
-               encodeName(computerName, computerNameEncoding, newStartup, newGlobals);
-
-               /*
-                * declare the first configured AppleTalk service / interface
-                * as the "home port".
-                */
-               if (CFArrayGetCount(newConfigFile) == 0) {
-                       CFStringAppend(portConfig, CFSTR("*"));
-                       primaryPort = CFRetain(ifName);
-               }
-               CFArrayAppendValue(newConfigFile, portConfig);
-
-               /*
-                * get the per-interface defaults
-                */
-               ifDefaults = CFDictionaryCreateMutable(NULL,
-                                                      0,
-                                                      &kCFTypeDictionaryKeyCallBacks,
-                                                      &kCFTypeDictionaryValueCallBacks);
-
-               defaultNetwork = CFDictionaryGetValue(service, kSCPropNetAppleTalkNetworkID);
-               defaultNode    = CFDictionaryGetValue(service, kSCPropNetAppleTalkNodeID);
-               if (isA_CFNumber(defaultNetwork) && isA_CFNumber(defaultNode)) {
-                       /*
-                        * set the default node and network
-                        */
-                       CFDictionarySetValue(ifDefaults,
-                                            kSCPropNetAppleTalkNetworkID,
-                                            defaultNetwork);
-                       CFDictionarySetValue(ifDefaults,
-                                            kSCPropNetAppleTalkNodeID,
-                                            defaultNode);
-               }
-
-               if ((CFDictionaryGetValueIfPresent(service,
-                                                  kSCPropNetAppleTalkDefaultZone,
-                                                  (const void **)&defaultZone) == TRUE)) {
-                       /*
-                        * set the default zone for this interface
-                        */
-                       CFDictionarySetValue(ifDefaults,
-                                            kSCPropNetAppleTalkDefaultZone,
-                                            defaultZone);
-               }
-
-               CFDictionarySetValue(newDefaults, ifName, ifDefaults);
-               CFRelease(ifDefaults);
-
-               switch (CFArrayGetCount(newConfigFile)) {
-                       case 1:
-                               /*
-                                * first AppleTalk interface
-                                */
-                               CFDictionarySetValue(newStartup, CFSTR("APPLETALK"), ifName);
-                               break;
-                       case 2:
-                               /* second AppleTalk interface */
-                               if (!CFEqual(CFDictionaryGetValue(newStartup, CFSTR("APPLETALK")),
-                                            CFSTR("-ROUTER-"))) {
-                                       /*
-                                        * if not routing (yet), configure as multi-home
-                                        */
-                                       CFDictionarySetValue(newStartup, CFSTR("APPLETALK"), CFSTR("-MULTIHOME-"));
-                               }
-                               break;
-               }
-
-               if (CFEqual(configMethod, kSCValNetAppleTalkConfigMethodRouter) ||
-                   CFEqual(configMethod, kSCValNetAppleTalkConfigMethodSeedRouter)) {
-                       /* if not a simple node, enable routing */
-                       CFDictionarySetValue(newStartup, CFSTR("APPLETALK"), CFSTR("-ROUTER-"));
-               }
-
-               /*
-                * establish the State:/Network/Service/nnn/AppleTalk key info
-                */
-               key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                                 kSCDynamicStoreDomainState,
-                                                                 CFDictionaryGetValue(service, CFSTR("ServiceID")),
-                                                                 kSCEntNetAppleTalk);
-               newDict = CFDictionaryCreateMutable(NULL,
-                                                   0,
-                                                   &kCFTypeDictionaryKeyCallBacks,
-                                                   &kCFTypeDictionaryValueCallBacks);
-               CFDictionaryAddValue(newDict, kSCPropInterfaceName, ifName);
-               cache_SCDynamicStoreSetValue(store, key, newDict);
-               CFRelease(newDict);
-               if (info) {
-                       j = CFArrayGetFirstIndexOfValue(info,
-                                                       CFRangeMake(0, CFArrayGetCount(info)),
-                                                       key);
-                       if (j != kCFNotFound) {
-                               CFArrayRemoveValueAtIndex(info, j);
-                       }
-               }
-               CFRelease(key);
-
-           nextIF :
-
-               if (portConfig) CFRelease(portConfig);
-       }
-
-       if (primaryZone) {
-               CFArrayRef              ifList;
-               CFMutableArrayRef       newIFList;
-
-               ifList = CFDictionaryGetValue(newZones, primaryZone);
-               if (CFArrayContainsValue(ifList,
-                                        CFRangeMake(0, CFArrayGetCount(ifList)),
-                                        primaryPort)) {
-                       newIFList = CFArrayCreateMutableCopy(NULL, 0, ifList);
-                       CFArrayAppendValue(newIFList, CFSTR("*"));
-                       CFDictionarySetValue(newZones, primaryZone, newIFList);
-                       CFRelease(newIFList);
-               }
-               CFRelease(primaryZone);
-       }
-       if (primaryPort) {
-               CFRelease(primaryPort);
-       }
-
-       /* sort the ports */
-       i = CFArrayGetCount(newConfigFile);
-       CFArraySortValues(newConfigFile,
-                         CFRangeMake(0, i),
-                         (CFComparatorFunction)CFStringCompare,
-                         NULL);
-
-       /* add the zones to the configuration */
-       CFDictionaryApplyFunction(newZones, addZoneToPorts, newConfigFile);
-       CFRelease(newZones);
-
-       /* sort the zones */
-       CFArraySortValues(newConfigFile,
-                         CFRangeMake(i, CFArrayGetCount(newConfigFile)-i),
-                         (CFComparatorFunction)CFStringCompare,
-                         NULL);
-
-       /* ensure that the last line of the configuration file is terminated */
-       CFArrayAppendValue(newConfigFile, CFSTR(""));
-
-       /*
-        * Check if we have a "ComputerName" and look elsewhere if we don't have
-        * one yet.
-        */
-       if (!CFDictionaryContainsKey(newStartup, CFSTR("APPLETALK_HOSTNAME")) &&
-           (setGlobals != NULL)) {
-               computerName = CFDictionaryGetValue(setGlobals,
-                                                   kSCPropNetAppleTalkComputerName);
-               if (CFDictionaryGetValueIfPresent(setGlobals,
-                                                 kSCPropNetAppleTalkComputerNameEncoding,
-                                                 (const void **)&num) &&
-                   isA_CFNumber(num)) {
-                       CFNumberGetValue(num, kCFNumberIntType, &computerNameEncoding);
-               } else {
-                       computerNameEncoding = CFStringGetSystemEncoding();
-               }
-               encodeName(computerName, computerNameEncoding, newStartup, newGlobals);
-       }
-       if (!CFDictionaryContainsKey(newStartup, CFSTR("APPLETALK_HOSTNAME"))) {
-               computerName = SCDynamicStoreCopyComputerName(store, &computerNameEncoding);
-               if (computerName) {
-                       encodeName(computerName, computerNameEncoding, newStartup, newGlobals);
-                       CFRelease(computerName);
-               }
-       }
-       if (!CFDictionaryContainsKey(newStartup, CFSTR("APPLETALK_HOSTNAME"))) {
-               struct utsname  name;
-
-               if (uname(&name) == 0) {
-                       computerName = CFStringCreateWithCString(NULL, name.nodename, kCFStringEncodingASCII);
-                       if (computerName) {
-                               encodeName(computerName, kCFStringEncodingASCII, NULL, newGlobals);
-                               CFRelease(computerName);
-                       }
-               }
-       }
-
-       /* compare the previous and current configurations */
-
-       curGlobalsX = CFDictionaryCreateMutableCopy(NULL, 0, curGlobals);
-       CFDictionaryRemoveValue(curGlobalsX, kSCDynamicStorePropNetPrimaryService);
-
-       newGlobalsX = CFDictionaryCreateMutableCopy(NULL, 0, newGlobals);
-       CFDictionaryRemoveValue(newGlobalsX, kSCDynamicStorePropNetPrimaryService);
-
-       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
-                                                        kSCDynamicStoreDomainState,
-                                                        kSCEntNetAppleTalk);
-
-       if (CFEqual(curGlobalsX   , newGlobalsX   ) &&
-           CFEqual(curConfigFile , newConfigFile) &&
-           CFEqual(curDefaults   , newDefaults  ) &&
-           CFEqual(curStartup    , newStartup   )
-           ) {
-               /*
-                * the configuration has not changed.
-                */
-
-               if (postGlobals) {
-                       /*
-                        * the requested configuration hasn't changed but we
-                        * now need to tell everyone that AppleTalk is active.
-                        */
-                       if (!SCDynamicStoreSetValue(store, key, newGlobals)) {
-                               SCLog(TRUE,
-                                     LOG_ERR,
-                                     CFSTR("SCDynamicStoreSetValue() failed: %s"),
-                                     SCErrorString(SCError()));
-                       }
-               }
-
-               CFRelease(newGlobals);
-               CFRelease(newConfigFile);
-               CFRelease(newDefaults);
-               CFRelease(newStartup);
-       } else if (CFArrayGetCount(newConfigFile) <= 1) {
-               /*
-                * the configuration has changed but there are no
-                * longer any interfaces configured for AppleTalk
-                * networking.
-                */
-
-               /*
-                * remove the global (State:/Network/Global/AppleTalk) key.
-                *
-                * Note: it will be restored later after AT networking has
-                *       been activated.
-                */
-
-               /* remove the (/etc/appletalk.cfg) configuration file */
-               (void)unlink(AT_CFG_FILE);
-
-               /*
-                * update the per-service (and global) state
-                */
-               cache_SCDynamicStoreRemoveValue(store, key);    // remove State:/Network/Global/AppleTalk
-               n = CFArrayGetCount(info);
-               for (i = 0; i < n; i++) {
-                       CFStringRef     xKey    = CFArrayGetValueAtIndex(info, i);
-
-                       cache_SCDynamicStoreRemoveValue(store, xKey);
-               }
-               cache_write(store);
-
-               /* flag this as a new configuration */
-               *newState = -(abs(curState) + 1);
-               changed = TRUE;
-       } else {
-               /*
-                * the configuration has changed.
-                */
-
-               /* update the (/etc/appletalk.cfg) configuration file */
-               configWrite(AT_CFG_FILE, newConfigFile);
-
-               /*
-                * update the per-service (and global) state
-                *
-                * Note: if present, we remove any existing global state key and allow it
-                *       to be restored after the stack has been re-started.
-                */
-               CFDictionaryApplyFunction(newDefaults, updateDefaults, NULL);
-               cache_SCDynamicStoreRemoveValue(store, key);    // remove State:/Network/Global/AppleTalk
-               n = CFArrayGetCount(info);
-               for (i = 0; i < n; i++) {
-                       CFStringRef     xKey    = CFArrayGetValueAtIndex(info, i);
-
-                       cache_SCDynamicStoreRemoveValue(store, xKey);
-               }
-               cache_write(store);
-
-               /* flag this as a new configuration */
-               *newState = abs(curState) + 1;
-               changed = TRUE;
-       }
-
-       CFRelease(curGlobalsX);
-       CFRelease(newGlobalsX);
-       CFRelease(key);
-
-       if (changed) {
-               CFRelease(curGlobals);
-               curGlobals    = newGlobals;
-               CFRelease(curConfigFile);
-               curConfigFile = newConfigFile;
-               CFRelease(curDefaults);
-               curDefaults   = newDefaults;
-               CFRelease(curStartup);
-               curStartup    = newStartup;
-       }
-
-       if (info)               CFRelease(info);
-       if (interfaces)         CFRelease(interfaces);
-       if (configuredServices) CFRelease(configuredServices);
-       if (setGlobals)         CFRelease(setGlobals);
-
-       cache_close();
-
-       return changed;
-}
-
-
-#include <sysexits.h>
-#define AT_CMD_SUCCESS         EX_OK   /* success */
-#define AT_CMD_ALREADY_RUNNING EX__MAX + 10
-#define AT_CMD_NOT_RUNNING     EX__MAX + 11
-
-
-static int
-stackState()
-{
-       int             ret;
-       int             sock;
-       at_state_t      state;
-
-       sock = socket(AF_APPLETALK, SOCK_RAW, 0);
-       ret  = ioctl(sock, AIOCGETSTATE, (caddr_t)&state);
-       (void)close(sock);
-       if (ret == -1) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("ioctl(AIOCGETSTATE) failed: %s"), strerror(errno));
-               return FALSE;
-       }
-
-       if (state.flags & AT_ST_STARTED) {
-               return abs(curState);
-       } else {
-               return -(abs(curState));
-       }
-}
-
-
-static pid_t   execCommand     = 0;
-static int     execRetry;
-
-
-static void
-stopComplete(pid_t pid, int status, struct rusage *rusage, void *context)
-{
-       execCommand = 0;
-
-       if (WIFEXITED(status)) {
-               switch (WEXITSTATUS(status)) {
-                       case AT_CMD_SUCCESS :
-                       case AT_CMD_NOT_RUNNING :
-                               SCLog(TRUE, LOG_NOTICE, CFSTR("AppleTalk shutdown complete"));
-                               if (curState > 0) {
-                                       // the stack is down but we really want it up
-                                       startAppleTalk(NULL, (void *)curState);
-                               }
-                               return;
-                       default :
-                               break;
-               }
-       }
-
-       SCLog(TRUE,
-             (execRetry > 1) ? LOG_NOTICE : LOG_ERR,
-             CFSTR("AppleTalk shutdown failed, status = %d%s"),
-             WEXITSTATUS(status),
-             (execRetry > 1) ? " (retrying)" : "");
-
-       // shutdown failed, retry
-       if (--execRetry > 0) {
-               CFRunLoopTimerContext   timerContext    = { 0, (void *)curState, NULL, NULL, NULL };
-               CFRunLoopTimerRef       timer;
-
-               timer = CFRunLoopTimerCreate(NULL,
-                                            CFAbsoluteTimeGetCurrent() + RETRY_DELAY,
-                                            0.0,
-                                            0,
-                                            0,
-                                            stopAppleTalk,
-                                            &timerContext);
-               CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopDefaultMode);
-               CFRelease(timer);
-               return;
-       } else {
-               // we weren't able to stop
-               curState = stackState();
-       }
-
-       return;
-}
-
-
-static void
-stopAppleTalk(CFRunLoopTimerRef timer, void *info)
-{
-       char    *argv[] = { "appletalk",
-                           "-d",
-                           NULL };
-
-       if (execCommand == 0) {
-               SCLog(TRUE, LOG_NOTICE, CFSTR("AppleTalk shutdown"));
-       } else {
-               SCLog(TRUE, LOG_NOTICE, CFSTR("AppleTalk shutdown skipped, transition in progress"));
-               return;
-       }
-
-       execCommand = _SCDPluginExecCommand(stopComplete,               // callback
-                                           info,                       // context
-                                           0,                          // uid
-                                           0,                          // gid
-                                           "/usr/sbin/appletalk",      // path
-                                           argv);                      // argv
-
-       if (!timer) {
-               execRetry = RETRY_LIMIT;        // initialize retry count
-       }
-
-       return;
-}
-
-
-static void
-startComplete(pid_t pid, int status, struct rusage *rusage, void *context)
-{
-       execCommand = 0;
-
-       if (WIFEXITED(status)) {
-               switch (WEXITSTATUS(status)) {
-                       case AT_CMD_SUCCESS :
-                               SCLog(TRUE, LOG_NOTICE, CFSTR("AppleTalk startup complete"));
-                               if ((curState < 0) || (curState > (int)context)) {
-                                       // the stack is now up but we really want it down
-                                       stopAppleTalk(NULL, (void *)curState);
-                               }
-                               return;
-                       case AT_CMD_ALREADY_RUNNING :
-                               // the stack is already up but we're not sure
-                               // if the configuration is correct, restart
-                               SCLog(TRUE, LOG_NOTICE, CFSTR("AppleTalk already running, restarting"));
-                               stopAppleTalk(NULL, (void *)curState);
-                               return;
-                       default :
-                               break;
-               }
-       }
-
-       SCLog(TRUE,
-             (execRetry > 1) ? LOG_NOTICE : LOG_ERR,
-             CFSTR("AppleTalk startup failed, status = %d%s"),
-             WEXITSTATUS(status),
-             (execRetry > 1) ? " (retrying)" : "");
-
-       // startup failed, retry
-       if (--execRetry > 0) {
-               CFRunLoopTimerContext   timerContext    = { 0, (void *)curState, NULL, NULL, NULL };
-               CFRunLoopTimerRef       timer;
-
-               timer = CFRunLoopTimerCreate(NULL,
-                                            CFAbsoluteTimeGetCurrent() + RETRY_DELAY,
-                                            0.0,
-                                            0,
-                                            0,
-                                            startAppleTalk,
-                                            &timerContext);
-               CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopDefaultMode);
-               CFRelease(timer);
-               return;
-       } else {
-               // we weren't able to start
-               curState = stackState();
-       }
-
-       return;
-}
-
-
-static void
-startAppleTalk(CFRunLoopTimerRef timer, void *info)
-{
-       int             argc            = 0;
-       char            *argv[8];
-       char            *computerName   = NULL;
-       char            *interface      = NULL;
-       CFStringRef     mode            = CFDictionaryGetValue(curStartup, CFSTR("APPLETALK"));
-       CFStringRef     name            = CFDictionaryGetValue(curStartup, CFSTR("APPLETALK_HOSTNAME"));
-
-       if (execCommand == 0) {
-               SCLog(TRUE, LOG_NOTICE, CFSTR("AppleTalk startup"));
-       } else {
-               SCLog(TRUE, LOG_NOTICE, CFSTR("AppleTalk startup skipped, transition in progress"));
-               return;
-       }
-
-       if (!mode) {
-               // Huh?
-               return;
-       }
-
-       // set command name
-       argv[argc++] = "appletalk";
-
-       // set hostname
-       if (name) {
-               computerName = _SC_cfstring_to_cstring(name, NULL, 0, kCFStringEncodingASCII);
-               if (computerName) {
-                       argv[argc++] = "-C";
-                       argv[argc++] = computerName;
-               } else {
-                       // could not convert name
-                       goto done;
-               }
-       }
-
-       // set mode
-       if (CFEqual(mode, CFSTR("-ROUTER-"))) {
-               argv[argc++] = "-r";
-       } else if (CFEqual(mode, CFSTR("-MULTIHOME-"))) {
-               argv[argc++] = "-x";
-       } else {
-               interface = _SC_cfstring_to_cstring(mode, NULL, 0, kCFStringEncodingASCII);
-               if (interface) {
-                       argv[argc++] = "-u";
-                       argv[argc++] = interface;
-               } else {
-                       // could not convert interface
-                       goto done;
-               }
-       }
-
-       // set non-interactive
-       argv[argc++] = "-q";
-
-       // close argument list
-       argv[argc++] = NULL;
-
-       execCommand = _SCDPluginExecCommand(startComplete,              // callback
-                                           info,                       // context
-                                           0,                          // uid
-                                           0,                          // gid
-                                           "/usr/sbin/appletalk",      // path
-                                           argv);                      // argv
-
-       if (!timer) {
-               execRetry = RETRY_LIMIT;        // initialize retry count
-       }
-
-    done :
-
-       if (computerName)       CFAllocatorDeallocate(NULL, computerName);
-       if (interface)          CFAllocatorDeallocate(NULL, interface);
-
-       return;
-}
-
-
-static void
-atConfigChangedCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *arg)
-{
-       boolean_t       configChanged;
-       int             newState;
-
-       configChanged = updateConfiguration(&newState);
-
-       if (configChanged && (execCommand == 0)) {
-               // if the configuration has changed and we're not already transitioning
-               if (newState > 0) {
-                       if (curState > 0) {
-                               // already running, restart [with new configuration]
-                               stopAppleTalk(NULL, (void *)newState);
-                       } else {
-                               startAppleTalk(NULL, (void *)newState);
-                       }
-               } else {
-                       if (curState > 0) {
-                               stopAppleTalk(NULL, (void *)newState);
-                       }
-               }
-       }
-
-       curState = newState;
-
-       return;
-}
-
-
-void
-stop_ATconfig(CFRunLoopSourceRef stopRls)
-{
-       // cleanup
-
-       if (storeRls != NULL) {
-               CFRunLoopSourceInvalidate(storeRls);
-               CFRelease(storeRls);
-               storeRls = NULL;
-       }
-
-       if (store != NULL) {
-               CFRelease(store);
-               store = NULL;
-               CFRelease(curGlobals);
-               CFRelease(curConfigFile);
-               CFRelease(curDefaults);
-               CFRelease(curStartup);
-       }
-
-       CFRunLoopSourceSignal(stopRls);
-       return;
-}
-
-
-void
-load_ATconfig(CFBundleRef bundle, Boolean bundleVerbose)
-{
-       CFStringRef             key;
-       CFMutableArrayRef       keys            = NULL;
-       CFStringRef             pattern;
-       CFMutableArrayRef       patterns        = NULL;
-
-       if (bundleVerbose) {
-               _verbose = TRUE;
-       }
-
-       SCLog(_verbose, LOG_DEBUG, CFSTR("load() called"));
-       SCLog(_verbose, LOG_DEBUG, CFSTR("  bundle ID = %@"), CFBundleGetIdentifier(bundle));
-
-       /* initialize a few globals */
-
-       curGlobals    = CFDictionaryCreateMutable(NULL,
-                                                 0,
-                                                 &kCFTypeDictionaryKeyCallBacks,
-                                                 &kCFTypeDictionaryValueCallBacks);
-       curConfigFile = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-       curDefaults   = CFDictionaryCreateMutable(NULL,
-                                                 0,
-                                                 &kCFTypeDictionaryKeyCallBacks,
-                                                 &kCFTypeDictionaryValueCallBacks);
-       curStartup    = CFDictionaryCreateMutable(NULL,
-                                                 0,
-                                                 &kCFTypeDictionaryKeyCallBacks,
-                                                 &kCFTypeDictionaryValueCallBacks);
-
-       /* open a "configd" store to allow cache updates */
-       store = SCDynamicStoreCreate(NULL,
-                                    CFSTR("AppleTalk Configuraton plug-in"),
-                                    atConfigChangedCallback,
-                                    NULL);
-       if (store == NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCreate() failed: %s"), SCErrorString(SCError()));
-               goto error;
-       }
-
-       /* establish notification keys and patterns */
-
-       keys     = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-       patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-
-       /* ...watch for (global) AppleTalk configuration changes */
-       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
-                                                        kSCDynamicStoreDomainSetup,
-                                                        kSCEntNetAppleTalk);
-       CFArrayAppendValue(keys, key);
-       CFRelease(key);
-
-       /* ...watch for (per-service) AppleTalk configuration changes */
-       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                             kSCDynamicStoreDomainSetup,
-                                                             kSCCompAnyRegex,
-                                                             kSCEntNetAppleTalk);
-       CFArrayAppendValue(patterns, pattern);
-       CFRelease(pattern);
-
-       /* ...watch for network interface link status changes */
-       pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                               kSCDynamicStoreDomainState,
-                                                               kSCCompAnyRegex,
-                                                               kSCEntNetLink);
-       CFArrayAppendValue(patterns, pattern);
-       CFRelease(pattern);
-
-       /* ...watch for (per-interface) AppleTalk configuration changes */
-       pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                               kSCDynamicStoreDomainState,
-                                                               kSCCompAnyRegex,
-                                                               kSCEntNetAppleTalk);
-       CFArrayAppendValue(patterns, pattern);
-       CFRelease(pattern);
-
-       /* ...watch for computer name changes */
-       key = SCDynamicStoreKeyCreateComputerName(NULL);
-       CFArrayAppendValue(keys, key);
-       CFRelease(key);
-
-       /* register the keys/patterns */
-       if (!SCDynamicStoreSetNotificationKeys(store, keys, patterns)) {
-               SCLog(TRUE, LOG_ERR,
-                     CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s"),
-                     SCErrorString(SCError()));
-               goto error;
-       }
-       CFRelease(keys);
-       CFRelease(patterns);
-
-       storeRls = SCDynamicStoreCreateRunLoopSource(NULL, store, 0);
-       if (!storeRls) {
-               SCLog(TRUE, LOG_ERR,
-                     CFSTR("SCDynamicStoreCreateRunLoopSource() failed: %s"),
-                     SCErrorString(SCError()));
-               goto error;
-       }
-       CFRunLoopAddSource(CFRunLoopGetCurrent(), storeRls, kCFRunLoopDefaultMode);
-
-       return;
-
-    error :
-
-       if (curGlobals)         CFRelease(curGlobals);
-       if (curConfigFile)      CFRelease(curConfigFile);
-       if (curDefaults)        CFRelease(curDefaults);
-       if (curStartup)         CFRelease(curStartup);
-       if (store)              CFRelease(store);
-       if (keys)               CFRelease(keys);
-       if (patterns)           CFRelease(patterns);
-       return;
-}
-
-
-#ifdef MAIN
-#include "cfManager.c"
-int
-main(int argc, char **argv)
-{
-       _sc_log     = FALSE;
-       _sc_verbose = (argc > 1) ? TRUE : FALSE;
-
-       load_ATconfig(CFBundleGetMainBundle(), (argc > 1) ? TRUE : FALSE);
-       CFRunLoopRun();
-       /* not reached */
-       exit(0);
-       return 0;
-}
-#endif
diff --git a/Plugins/ATconfig/cfManager.c b/Plugins/ATconfig/cfManager.c
deleted file mode 100644 (file)
index 72196cd..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (c) 2000-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@
- */
-
-/*
- * Modification History
- *
- * July 17, 2000               Allan Nathanson <ajn@apple.com>
- * - initial revision
- */
-
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "cfManager.h"
-
-
-#ifdef NOTNOW
-/*
- * Opens a configuration file and returns a CFArrayRef consisting
- * of a CFStringRef for each line.
- */
-__private_extern__
-CFArrayRef
-configRead(const char *path)
-{
-       int                     fd;
-       struct stat             statBuf;
-       CFMutableDataRef        data;
-       CFStringRef             str;
-       CFArrayRef              config  = NULL;
-
-       fd = open(path, O_RDONLY, 0644);
-       if (fd == -1) {
-               goto done;
-       }
-       if (fstat(fd, &statBuf) == -1) {
-               goto done;
-       }
-       if ((statBuf.st_mode & S_IFMT) != S_IFREG) {
-               goto done;
-       }
-
-       data = CFDataCreateMutable(NULL, statBuf.st_size);
-       CFDataSetLength(data, statBuf.st_size);
-       if(read(fd, (void *)CFDataGetMutableBytePtr(data), statBuf.st_size) != statBuf.st_size) {
-               CFRelease(data);
-               goto done;
-       }
-
-       str = CFStringCreateFromExternalRepresentation(NULL, data, kCFStringEncodingMacRoman);
-       CFRelease(data);
-
-       config = CFStringCreateArrayBySeparatingStrings(NULL, str, CFSTR("\n"));
-       CFRelease(str);
-
-    done:
-
-       if (fd != -1) {
-               close(fd);
-       }
-       if (config == NULL) {
-               CFMutableArrayRef       emptyConfig;
-
-               /* pretend that we found an empty file */
-               emptyConfig = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-               CFArrayAppendValue(emptyConfig, CFSTR(""));
-               config = (CFArrayRef)emptyConfig;
-       }
-       return config;
-}
-#endif /* NOTNOW */
-
-/*
- * Writes a new configuration file with the contents of a CFArrayRef. Each
- * element of the array is a CFStringRef.
- */
-__private_extern__
-void
-configWrite(const char *path, CFArrayRef config)
-{
-       CFStringRef     str;
-       CFDataRef       data;
-       int             fd = -1;
-       int             len;
-
-       str  = CFStringCreateByCombiningStrings(NULL, config, CFSTR("\n"));
-       data = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingMacRoman, (UInt8)'.');
-       CFRelease(str);
-
-       fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0644);
-       if (fd == -1) {
-               goto done;
-       }
-
-       len = CFDataGetLength(data);
-       if (len) {
-               (void)write(fd, CFDataGetBytePtr(data), len);
-       }
-
-    done:
-
-       if (fd != -1)
-               close(fd);
-       CFRelease(data);
-       return;
-}
-
-
-#ifdef NOTNOW
-__private_extern__
-void
-configSet(CFMutableArrayRef config, CFStringRef key, CFStringRef value)
-{
-       CFMutableStringRef      pref;
-       CFIndex                 configLen       = CFArrayGetCount(config);
-       CFIndex                 i;
-       CFIndex                 n;
-       CFMutableStringRef      newValue;
-       CFRange                 range;
-       CFStringRef             specialChars    = CFSTR(" \"'$!|\\<>`{}[]");
-       boolean_t               mustQuote       = FALSE;
-
-       /* create search prefix */
-       pref = CFStringCreateMutableCopy(NULL, 0, key);
-       CFStringAppend(pref, CFSTR("="));
-
-       /*
-        * create new / replacement value
-        *
-        * Note: Since the configuration file may be processed by a
-        *       shell script we need to ensure that, if needed, the
-        *       string is properly quoted.
-        */
-       newValue = CFStringCreateMutableCopy(NULL, 0, value);
-
-       n = CFStringGetLength(specialChars);
-       for (i = 0; i < n; i++) {
-               CFStringRef     specialChar;
-
-               specialChar = CFStringCreateWithSubstring(NULL, specialChars, CFRangeMake(i, 1));
-               range = CFStringFind(newValue, specialChar, 0);
-               CFRelease(specialChar);
-               if (range.location != kCFNotFound) {
-                       /* this string has at least one special character */
-                       mustQuote = TRUE;
-                       break;
-               }
-       }
-
-       if (mustQuote) {
-               CFStringRef     charsToQuote    = CFSTR("\\\"$`");
-
-               /*
-                * in addition to quoting the entire string we also need to escape the
-                * space " " and backslash "\" characters
-                */
-               n = CFStringGetLength(charsToQuote);
-               for (i = 0; i < n; i++) {
-                       CFStringRef     quoteChar;
-                       CFArrayRef      matches;
-
-                       quoteChar = CFStringCreateWithSubstring(NULL, charsToQuote, CFRangeMake(i, 1));
-                       range     = CFRangeMake(0, CFStringGetLength(newValue));
-                       matches   = CFStringCreateArrayWithFindResults(NULL,
-                                                                      newValue,
-                                                                      quoteChar,
-                                                                      range,
-                                                                      0);
-                       CFRelease(quoteChar);
-
-                       if (matches) {
-                               CFIndex j = CFArrayGetCount(matches);
-
-                               while (--j >= 0) {
-                                       const CFRange   *range;
-
-                                       range = CFArrayGetValueAtIndex(matches, j);
-                                       CFStringInsert(newValue, range->location, CFSTR("\\"));
-                               }
-                               CFRelease(matches);
-                       }
-               }
-
-               CFStringInsert(newValue, 0, CFSTR("\""));
-               CFStringAppend(newValue, CFSTR("\""));
-       }
-
-       /* locate existing key */
-       for (i = 0; i < configLen; i++) {
-               if (CFStringHasPrefix(CFArrayGetValueAtIndex(config, i), pref)) {
-                       break;
-               }
-       }
-
-       CFStringAppend(pref, newValue);
-       CFRelease(newValue);
-       if (i < configLen) {
-               /* if replacing an existing entry */
-               CFArraySetValueAtIndex(config, i, pref);
-       } else {
-               /*
-                * if new entry, insert it just prior to the last (emtpy)
-                * array element.
-                */
-               CFArrayInsertValueAtIndex(config, configLen-1, pref);
-       }
-       CFRelease(pref);
-
-       return;
-}
-
-
-__private_extern__
-void
-configRemove(CFMutableArrayRef config, CFStringRef key)
-{
-       CFMutableStringRef      pref;
-       CFIndex                 configLen = CFArrayGetCount(config);
-       CFIndex                 i;
-
-       /* create search prefix */
-       pref = CFStringCreateMutableCopy(NULL, 0, key);
-       CFStringAppend(pref, CFSTR("="));
-
-       /* locate existing key */
-       for (i = 0; i < configLen; i++) {
-               if (CFStringHasPrefix(CFArrayGetValueAtIndex(config, i), pref)) {
-                       /* entry found, remove it */
-                       CFArrayRemoveValueAtIndex(config, i);
-                       break;
-               }
-       }
-
-       CFRelease(pref);
-       return;
-}
-#endif /* NOTNOW */
diff --git a/Plugins/ATconfig/cfManager.h b/Plugins/ATconfig/cfManager.h
deleted file mode 100644 (file)
index 6c28c2c..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, 2003-2005 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@
- */
-
-/*
- * Modification History
- *
- * July 17, 2000               Allan Nathanson <ajn@apple.com>
- * - initial revision
- */
-
-#ifndef __CFMANAGER_H
-#define __CFMANAGER_H
-
-#include <CoreFoundation/CoreFoundation.h>
-#include <sys/cdefs.h>
-
-
-__BEGIN_DECLS
-
-#ifdef NOTNOW
-CFArrayRef     configRead      __P((const char *path));
-#endif /* NOTNOW */
-void           configWrite     __P((const char *path, CFArrayRef config));
-#ifdef NOTNOW
-void           configSet       __P((CFMutableArrayRef config, CFStringRef key, CFStringRef value));
-void           configRemove    __P((CFMutableArrayRef config, CFStringRef key));
-#endif /* NOTNOW */
-
-__END_DECLS
-
-
-#endif /* __CFMANAGER_H */
index 2fcfb065b34a60d4d3b8271ca599429b5f82b36c..473dee5894d662ebe5a9a4ccae7f3a5140dee1f0 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.IPConfiguration</string>
@@ -28,7 +28,7 @@
        <key>Builtin</key>
        <true/>
        <key>mdns_timeout</key>
-       <integer>2</integer>
+       <integer>5</integer>
        <key>pdns_timeout</key>
        <integer>5</integer>
        <key>AppendStateArrayToSetupArray</key>
index 80077c8eb2b7143d998928a199eaabf255e4969d..f3106a4ccce4ca2397dfff82247cad0042527533 100644 (file)
@@ -1,14 +1,55 @@
-test_dns: Makefile dns-configuration.h dns-configuration.c
-       cc -Wall -g -o test_dns -DMAIN dns-configuration.c -framework SystemConfiguration -framework CoreFoundation -ldnsinfo
+EXTRA_CFLAGS=
+
+all: test_proxy
+
+# ----------
+
+shared_dns_info.h shared_dns_infoUser.c: ../../dnsinfo/shared_dns_info.defs
+       mig ../../dnsinfo/shared_dns_info.defs
+
+shared_dns_infoUser.o: shared_dns_info.h shared_dns_infoUser.c
+       cc -I../../dnsinfo -Wall -O0 -g -c shared_dns_infoUser.c
+
+dnsinfo_create.o: shared_dns_info.h ../../dnsinfo/dnsinfo_create.h ../../dnsinfo/dnsinfo_create.c
+       cc -I. -I../../dnsinfo -Wall -O0 -g -c ../../dnsinfo/dnsinfo_create.c
+
+dnsinfo_flatfile.o: ../../dnsinfo/dnsinfo_copy.c ../../dnsinfo/dnsinfo_flatfile.c shared_dns_info.h
+       cc -I../../dnsinfo -D_PATH_RESOLVER_DIR='"/var/tmp/resolver"' -Wall -O0 -g -c ../../dnsinfo/dnsinfo_flatfile.c
+
+dnsinfo_private.o: ../../dnsinfo/dnsinfo_private.h ../../dnsinfo/dnsinfo_private.c
+       cc -I../../dnsinfo -Wall -O0 -g -c ../../dnsinfo/dnsinfo_private.c
+
+dns-configuration.o: dns-configuration.h dns-configuration.c dnsinfo_create.o
+       cc -I. -I../../dnsinfo -DMAIN -Wall -O0 -g -c dns-configuration.c
+
+proxy-configuration.o: proxy-configuration.h proxy-configuration.c
+       cc -I. -Wall -O0 -g -c proxy-configuration.c
+
+smb-configuration.o: smb-configuration.c
+       cc -I. -Wall -O0 -g -c smb-configuration.c
+
+# ----------
+
+test_dns: Makefile dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_private.o shared_dns_infoUser.o dns-configuration.o
+       cc -o test_dns dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_private.o shared_dns_infoUser.o dns-configuration.o ${EXTRA_CFLAGS} -framework SystemConfiguration -framework CoreFoundation
+
+# ----------
+
+test_proxy: Makefile proxy-configuration.h proxy-configuration.c
+       cc -Wall -O0 -g -o test_proxy -DMAIN -DDEBUG proxy-configuration.c ${EXTRA_CFLAGS} -framework SystemConfiguration -framework CoreFoundation
+
+# ----------
 
 test_smb: Makefile smb-configuration.h smb-configuration.c
-       cc -Wall -g -o test_smb -DMAIN -DDEBUG smb-configuration.c -framework SystemConfiguration -framework CoreFoundation
+       cc -Wall -O0 -g -o test_smb -DMAIN -DDEBUG smb-configuration.c ${EXTRA_CFLAGS} -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.o: ip_plugin.c
+       cc -I. -I../../dnsinfo -DTEST_IPV4_ROUTELIST -Wall -O0 -g -c -o test_ipv4_routelist.o ip_plugin.c
+
+test_ipv4_routelist: test_ipv4_routelist.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_private.o shared_dns_infoUser.o smb-configuration.o
+       cc -Wall -O0 -g -o test_ipv4_routelist test_ipv4_routelist.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_private.o shared_dns_infoUser.o smb-configuration.o -framework SystemConfiguration -framework CoreFoundation
 
 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
@@ -16,9 +57,21 @@ test_ipv4_routelist_reference.txt: test_ipv4_routelist
 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
 
+# ----------
+
+IPMonitor.o: ip_plugin.c
+       cc -I. -I../../dnsinfo -DTEST_IPMONITOR -Wall -O0 -g -c -o IPMonitor.o ip_plugin.c
+
+IPMonitor: IPMonitor.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_private.o shared_dns_infoUser.o smb-configuration.o
+       cc -Wall -O0 -g -o IPMonitor IPMonitor.o dnsinfo_create.o dnsinfo_flatfile.o dnsinfo_private.o shared_dns_infoUser.o smb-configuration.o -framework SystemConfiguration -framework CoreFoundation
+
+# ----------
 
 clean:
-       rm -rf  test_dns test_dns.dSYM  \
-               test_smb test_smb.dSYM  \
-               test_ipv4_routelist test_ipv4_routelist.dSYM    \
+       rm -rf  *.o                                                             \
+               shared_dns_info.h shared_dns_infoServer.c shared_dns_infoUser.c \
+               test_dns test_dns.dSYM                                          \
+               test_proxy test_proxy.dSYM                                      \
+               test_smb test_smb.dSYM                                          \
+               test_ipv4_routelist test_ipv4_routelist.dSYM                    \
                IPMonitor IPMonitor.dSYM
index e5b860af3919efc5103df9c8b7f4857f1c62ce0f..f60b512bd08676b0c565897bd87cfea12ea7a473 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -54,6 +54,12 @@ extern uint32_t notify_monitor_file(int token, const char *name, int flags);
 #include <dnsinfo.h>
 #include <dnsinfo_create.h>
 
+#ifdef MAIN
+#undef MAIN
+#include "dnsinfo_copy.c"
+#define        MAIN
+#endif // MAIN
+
 #include <dns_sd.h>
 #ifndef        kDNSServiceCompMulticastDNS
 #define        kDNSServiceCompMulticastDNS     "MulticastDNS"
@@ -70,10 +76,10 @@ static      CFNumberRef     S_pdns_timeout  = NULL;
 
 
 static void
-add_resolver(CFMutableArrayRef supplemental, CFMutableDictionaryRef resolver)
+add_resolver(CFMutableArrayRef resolvers, CFMutableDictionaryRef resolver)
 {
        CFIndex         i;
-       CFIndex         n_supplemental;
+       CFIndex         n_resolvers;
        CFNumberRef     order;
        uint32_t        order_val       = 0;
 
@@ -84,12 +90,12 @@ add_resolver(CFMutableArrayRef supplemental, CFMutableDictionaryRef resolver)
                order_val = 0;
        }
 
-       n_supplemental = CFArrayGetCount(supplemental);
-       for (i = 0; i < n_supplemental; i++) {
-               CFDictionaryRef         supplemental_resolver;
+       n_resolvers = CFArrayGetCount(resolvers);
+       for (i = 0; i < n_resolvers; i++) {
+               CFDictionaryRef         match_resolver;
 
-               supplemental_resolver = CFArrayGetValueAtIndex(supplemental, i);
-               if (CFEqual(resolver, supplemental_resolver)) {
+               match_resolver = CFArrayGetValueAtIndex(resolvers, i);
+               if (CFEqual(resolver, match_resolver)) {
                        // a real duplicate
                        return;
                }
@@ -98,24 +104,24 @@ add_resolver(CFMutableArrayRef supplemental, CFMutableDictionaryRef resolver)
                        CFMutableDictionaryRef  compare;
                        Boolean                 match;
 
-                       compare = CFDictionaryCreateMutableCopy(NULL, 0, supplemental_resolver);
+                       compare = CFDictionaryCreateMutableCopy(NULL, 0, match_resolver);
                        CFDictionarySetValue(compare, kSCPropNetDNSSearchOrder, order);
                        match = CFEqual(resolver, compare);
                        CFRelease(compare);
                        if (match) {
-                               CFNumberRef     supplemental_order;
-                               uint32_t        supplemental_order_val  = 0;
+                               CFNumberRef     match_order;
+                               uint32_t        match_order_val = 0;
 
                                // if only the search order's are different
-                               supplemental_order = CFDictionaryGetValue(supplemental_resolver, kSCPropNetDNSSearchOrder);
-                               if (!isA_CFNumber(supplemental_order) ||
-                                   !CFNumberGetValue(supplemental_order, kCFNumberIntType, &supplemental_order_val)) {
-                                       supplemental_order_val = 0;
+                               match_order = CFDictionaryGetValue(match_resolver, kSCPropNetDNSSearchOrder);
+                               if (!isA_CFNumber(match_order) ||
+                                   !CFNumberGetValue(match_order, kCFNumberIntType, &match_order_val)) {
+                                       match_order_val = 0;
                                }
 
-                               if (order_val < supplemental_order_val ) {
+                               if (order_val < match_order_val ) {
                                        // if we should prefer this match resolver, else just skip it
-                                       CFArraySetValueAtIndex(supplemental, i, resolver);
+                                       CFArraySetValueAtIndex(resolvers, i, resolver);
                                }
 
                                return;
@@ -123,17 +129,17 @@ add_resolver(CFMutableArrayRef supplemental, CFMutableDictionaryRef resolver)
                }
        }
 
-       order = CFNumberCreate(NULL, kCFNumberIntType, &n_supplemental);
+       order = CFNumberCreate(NULL, kCFNumberIntType, &n_resolvers);
        CFDictionarySetValue(resolver, CFSTR("*ORDER*"), order);
        CFRelease(order);
 
-       CFArrayAppendValue(supplemental, resolver);
+       CFArrayAppendValue(resolvers, resolver);
        return;
 }
 
 
 static void
-add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t defaultOrder)
+add_supplemental(CFMutableArrayRef resolvers, CFDictionaryRef dns, uint32_t defaultOrder)
 {
        CFArrayRef      domains;
        CFIndex         i;
@@ -155,7 +161,7 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d
 
        /*
         * yes, this is a "supplemental" resolver configuration, expand
-        * the match domains and add each to the supplemental list.
+        * the match domains and add each to the resolvers list.
         */
        for (i = 0; i < n_domains; i++) {
                CFStringRef             match_domain;
@@ -167,16 +173,8 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d
                        continue;
                }
 
-               match_order = (orders != NULL) ? CFArrayGetValueAtIndex(orders, i) : NULL;
-
                match_resolver = CFDictionaryCreateMutableCopy(NULL, 0, dns);
 
-               // remove keys we don't want in a supplemental resolver
-               CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSupplementalMatchDomains);
-               CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSupplementalMatchOrders);
-               CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSearchDomains);
-               CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSortList);
-
                // set supplemental resolver "domain"
                if (CFStringGetLength(match_domain) > 0) {
                        CFDictionarySetValue(match_resolver, kSCPropNetDNSDomainName, match_domain);
@@ -185,6 +183,7 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d
                }
 
                // set supplemental resolver "search_order"
+               match_order = (orders != NULL) ? CFArrayGetValueAtIndex(orders, i) : NULL;
                if (isA_CFNumber(match_order)) {
                        CFDictionarySetValue(match_resolver, kSCPropNetDNSSearchOrder, match_order);
                } else if (!CFDictionaryContainsKey(match_resolver, kSCPropNetDNSSearchOrder)) {
@@ -196,7 +195,14 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d
 
                        defaultOrder++;         // if multiple domains, maintain ordering
                }
-               add_resolver(supplemental, match_resolver);
+
+               // remove keys we don't want in a supplemental resolver
+               CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSupplementalMatchDomains);
+               CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSupplementalMatchOrders);
+               CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSearchDomains);
+               CFDictionaryRemoveValue(match_resolver, kSCPropNetDNSSortList);
+
+               add_resolver(resolvers, match_resolver);
                CFRelease(match_resolver);
        }
 
@@ -208,7 +214,7 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d
 
 
 static void
-add_supplemental_resolvers(CFMutableArrayRef supplemental, CFDictionaryRef services, CFArrayRef service_order)
+add_supplemental_resolvers(CFMutableArrayRef resolvers, CFDictionaryRef services, CFArrayRef service_order)
 {
        const void *            keys_q[N_QUICK];
        const void **           keys    = keys_q;
@@ -254,7 +260,7 @@ add_supplemental_resolvers(CFMutableArrayRef supplemental, CFDictionaryRef servi
                        defaultOrder += (DEFAULT_SEARCH_ORDER / 1000) * n_services;
                }
 
-               add_supplemental(supplemental, dns, defaultOrder);
+               add_supplemental(resolvers, dns, defaultOrder);
        }
 
        if (keys != keys_q) {
@@ -267,7 +273,7 @@ add_supplemental_resolvers(CFMutableArrayRef supplemental, CFDictionaryRef servi
 
 
 static void
-add_multicast_resolvers(CFMutableArrayRef supplemental, CFArrayRef multicastResolvers)
+add_multicast_resolvers(CFMutableArrayRef resolvers, CFArrayRef multicastResolvers)
 {
        CFIndex i;
        CFIndex n;
@@ -280,7 +286,8 @@ add_multicast_resolvers(CFMutableArrayRef supplemental, CFArrayRef multicastReso
                CFMutableDictionaryRef  resolver;
 
                domain = CFArrayGetValueAtIndex(multicastResolvers, i);
-               if (!isA_CFString(domain) || (CFStringGetLength(domain) == 0)) {
+               domain = _SC_trimDomain(domain);
+               if (domain == NULL) {
                        continue;
                }
 
@@ -300,8 +307,9 @@ add_multicast_resolvers(CFMutableArrayRef supplemental, CFArrayRef multicastReso
                if (S_mdns_timeout != NULL) {
                        CFDictionarySetValue(resolver, kSCPropNetDNSServerTimeout, S_mdns_timeout);
                }
-               add_resolver(supplemental, resolver);
+               add_resolver(resolvers, resolver);
                CFRelease(resolver);
+               CFRelease(domain);
        }
 
        return;
@@ -309,7 +317,7 @@ add_multicast_resolvers(CFMutableArrayRef supplemental, CFArrayRef multicastReso
 
 
 static void
-add_private_resolvers(CFMutableArrayRef supplemental, CFArrayRef privateResolvers)
+add_private_resolvers(CFMutableArrayRef resolvers, CFArrayRef privateResolvers)
 {
        CFIndex i;
        CFIndex n;
@@ -322,7 +330,8 @@ add_private_resolvers(CFMutableArrayRef supplemental, CFArrayRef privateResolver
                CFMutableDictionaryRef  resolver;
 
                domain = CFArrayGetValueAtIndex(privateResolvers, i);
-               if (!isA_CFString(domain) || (CFStringGetLength(domain) == 0)) {
+               domain = _SC_trimDomain(domain);
+               if (domain == NULL) {
                        continue;
                }
 
@@ -342,8 +351,9 @@ add_private_resolvers(CFMutableArrayRef supplemental, CFArrayRef privateResolver
                if (S_pdns_timeout != NULL) {
                        CFDictionarySetValue(resolver, kSCPropNetDNSServerTimeout, S_pdns_timeout);
                }
-               add_resolver(supplemental, resolver);
+               add_resolver(resolvers, resolver);
                CFRelease(resolver);
+               CFRelease(domain);
        }
 
        return;
@@ -394,49 +404,8 @@ compareBySearchOrder(const void *val1, const void *val2, void *context)
 }
 
 
-static CFStringRef
-trimDomain(CFStringRef domain)
-{
-       CFIndex length;
-
-       if (!isA_CFString(domain)) {
-               return NULL;
-       }
-
-       // remove any leading/trailing dots
-       length = CFStringGetLength(domain);
-       if ((length > 0) &&
-           (CFStringFindWithOptions(domain,
-                                    CFSTR("."),
-                                    CFRangeMake(0, 1),
-                                    kCFCompareAnchored,
-                                    NULL) ||
-            CFStringFindWithOptions(domain,
-                                    CFSTR("."),
-                                    CFRangeMake(0, length),
-                                    kCFCompareAnchored|kCFCompareBackwards,
-                                    NULL))) {
-               CFMutableStringRef      trimmed;
-
-               trimmed = CFStringCreateMutableCopy(NULL, 0, domain);
-               CFStringTrim(trimmed, CFSTR("."));
-               domain = (CFStringRef)trimmed;
-               length = CFStringGetLength(domain);
-       } else {
-               CFRetain(domain);
-       }
-
-       if (length == 0) {
-               CFRelease(domain);
-               domain = NULL;
-       }
-
-       return domain;
-}
-
-
-static void
-update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef supplemental)
+static CFArrayRef
+extract_search_domains(CFMutableDictionaryRef defaultDomain, CFArrayRef supplemental)
 {
        CFStringRef             defaultDomainName       = NULL;
        uint32_t                defaultOrder            = DEFAULT_SEARCH_ORDER;
@@ -446,29 +415,23 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
        CFMutableArrayRef       mySearchDomains;
        CFMutableArrayRef       mySupplemental          = NULL;
        CFIndex                 n_supplemental;
-       Boolean                 searchDomainAdded       = FALSE;
 
-       n_supplemental = CFArrayGetCount(supplemental);
-       if (n_supplemental == 0) {
-               // if no supplemental domains
-               return;
-       }
+       mySearchDomains = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
-       if (*defaultDomain != NULL) {
+       if (defaultDomain != NULL) {
                CFNumberRef     num;
 
-               num = CFDictionaryGetValue(*defaultDomain, kSCPropNetDNSSearchOrder);
+               num = CFDictionaryGetValue(defaultDomain, kSCPropNetDNSSearchOrder);
                if (!isA_CFNumber(num) ||
                    !CFNumberGetValue(num, kCFNumberIntType, &defaultOrder)) {
                        defaultOrder = DEFAULT_SEARCH_ORDER;
                }
 
-               defaultDomainName    = CFDictionaryGetValue(*defaultDomain, kSCPropNetDNSDomainName);
-               defaultSearchDomains = CFDictionaryGetValue(*defaultDomain, kSCPropNetDNSSearchDomains);
+               defaultDomainName    = CFDictionaryGetValue(defaultDomain, kSCPropNetDNSDomainName);
+               defaultSearchDomains = CFDictionaryGetValue(defaultDomain, kSCPropNetDNSSearchDomains);
        }
 
-       mySearchDomains = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-
+       // validate the provided "search" domains or move/expand/promote the "domain" name
        if (isA_CFArray(defaultSearchDomains)) {
                CFIndex n_search;
 
@@ -477,18 +440,50 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
                        CFStringRef     search;
 
                        search = CFArrayGetValueAtIndex(defaultSearchDomains, i);
-                       search = trimDomain(search);
+                       search = _SC_trimDomain(search);
                        if (search != NULL) {
                                CFArrayAppendValue(mySearchDomains, search);
                                CFRelease(search);
                        }
                }
        } else {
-               defaultDomainName = trimDomain(defaultDomainName);
+               defaultDomainName = _SC_trimDomain(defaultDomainName);
                if (defaultDomainName != NULL) {
-                       char    *domain;
-                       int     domain_parts    = 1;
-                       char    *dp;
+                       CFStringRef     defaultOptions;
+                       char            *domain;
+                       int             domain_parts    = 1;
+                       char            *dp;
+                       int             ndots           = 1;
+
+#define        NDOTS_OPT       "ndots="
+#define        NDOTS_OPT_LEN   (sizeof("ndots=") - 1)
+
+                       defaultOptions = CFDictionaryGetValue(defaultDomain, kSCPropNetDNSOptions);
+                       if (defaultOptions != NULL) {
+                               char    *cp;
+                               char    *options;
+
+                               options = _SC_cfstring_to_cstring(defaultOptions,
+                                                                NULL,
+                                                                0,
+                                                                kCFStringEncodingUTF8);
+                               cp = strstr(options, NDOTS_OPT);
+                               if ((cp != NULL) &&
+                                   ((cp == 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)) && (val > 0)) {
+                                               ndots = val;
+                                       }
+                               }
+                               CFAllocatorDeallocate(NULL, options);
+                       }
 
                        domain = _SC_cfstring_to_cstring(defaultDomainName,
                                                         NULL,
@@ -503,23 +498,31 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
                                }
                        }
 
+                       // move "domain" to "search" list (and expand as needed)
+                       i = LOCALDOMAINPARTS;
                        dp = domain;
-                       for (i = LOCALDOMAINPARTS; i <= domain_parts; i++) {
+                       do {
                                CFStringRef     search;
-
-                               search = CFStringCreateWithCString(NULL,
-                                                                  dp,
-                                                                  kCFStringEncodingUTF8);
-                               CFArrayAppendValue(mySearchDomains, search);
-                               CFRelease(search);
+                               CFStringRef     str;
+
+                               str = CFStringCreateWithCString(NULL,
+                                                               dp,
+                                                               kCFStringEncodingUTF8);
+                               search = _SC_trimDomain(str);
+                               CFRelease(str);
+                               if (search != NULL) {
+                                       CFArrayAppendValue(mySearchDomains, search);
+                                       CFRelease(search);
+                               }
 
                                dp = strchr(dp, '.') + 1;
-                       }
-
+                       } while (++i <= (domain_parts - ndots));
                        CFAllocatorDeallocate(NULL, domain);
                }
        }
 
+       // add any supplemental "domain" names to the search list
+       n_supplemental = (supplemental != NULL) ? CFArrayGetCount(supplemental) : 0;
        if (n_supplemental > 1) {
                mySupplemental = CFArrayCreateMutableCopy(NULL, 0, supplemental);
                CFArraySortValues(mySupplemental,
@@ -528,7 +531,6 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
                                  NULL);
                supplemental = mySupplemental;
        }
-
        for (i = 0; i < n_supplemental; i++) {
                CFDictionaryRef dns;
                CFIndex         domainIndex;
@@ -556,7 +558,7 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
                }
 
                supplementalDomain = CFDictionaryGetValue(dns, kSCPropNetDNSDomainName);
-               supplementalDomain = trimDomain(supplementalDomain);
+               supplementalDomain = _SC_trimDomain(supplementalDomain);
                if (supplementalDomain == NULL) {
                        continue;
                }
@@ -589,30 +591,195 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
                                                  defaultSearchIndex,
                                                  supplementalDomain);
                        defaultSearchIndex++;
-                       searchDomainAdded = TRUE;
                } else {
                        if (domainIndex == kCFNotFound) {
                                // add to the (end of the) search list
                                CFArrayAppendValue(mySearchDomains, supplementalDomain);
-                               searchDomainAdded = TRUE;
                        }
                }
 
                CFRelease(supplementalDomain);
        }
+       if (mySupplemental != NULL) CFRelease(mySupplemental);
+
+       // update the "search" domains
+       if (CFArrayGetCount(mySearchDomains) == 0) {
+               CFRelease(mySearchDomains);
+               mySearchDomains = NULL;
+       }
+
+       // remove the "domain" name and "search" list
+       CFDictionaryRemoveValue(defaultDomain, kSCPropNetDNSDomainName);
+       CFDictionaryRemoveValue(defaultDomain, kSCPropNetDNSSearchDomains);
+
+       return mySearchDomains;
+}
+
 
-       if (searchDomainAdded) {
-               if (*defaultDomain == NULL) {
-                       *defaultDomain = CFDictionaryCreateMutable(NULL,
-                                                                  0,
-                                                                  &kCFTypeDictionaryKeyCallBacks,
-                                                                  &kCFTypeDictionaryValueCallBacks);
+static void
+add_scoped_resolvers(CFMutableArrayRef scoped, CFDictionaryRef services, CFArrayRef service_order)
+{
+       const void *            keys_q[N_QUICK];
+       const void **           keys    = keys_q;
+       CFIndex                 i;
+       CFIndex                 n_order;
+       CFIndex                 n_services;
+       CFMutableArrayRef       order;
+       CFMutableSetRef         seen;
+
+       n_services = isA_CFDictionary(services) ? CFDictionaryGetCount(services) : 0;
+       if (n_services == 0) {
+               return;         // if no services
+       }
+
+       // ensure that we process all services in order
+
+       n_order = isA_CFArray(service_order) ? CFArrayGetCount(service_order) : 0;
+       if (n_order > 0) {
+               order = CFArrayCreateMutableCopy(NULL, 0, service_order);
+       } else{
+               order = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       }
+
+       if (n_services > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) {
+               keys = CFAllocatorAllocate(NULL, n_services * sizeof(CFTypeRef), 0);
+       }
+       CFDictionaryGetKeysAndValues(services, keys, NULL);
+       for (i = 0; i < n_services; i++) {
+               CFStringRef     serviceID = (CFStringRef)keys[i];
+
+               if (!CFArrayContainsValue(order, CFRangeMake(0, n_order), serviceID)) {
+                       CFArrayAppendValue(order, serviceID);
+                       n_order++;
                }
-               CFDictionarySetValue(*defaultDomain, kSCPropNetDNSSearchDomains, mySearchDomains);
+       }
+       if (keys != keys_q) {
+               CFAllocatorDeallocate(NULL, keys);
        }
 
-       CFRelease(mySearchDomains);
-       if (mySupplemental != NULL) CFRelease(mySupplemental);
+       // iterate over services
+
+       seen = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+       for (i = 0; i < n_order; i++) {
+               CFDictionaryRef         dns;
+               uint32_t                flags;
+               unsigned int            if_index;
+               char                    if_name[IF_NAMESIZE];
+               CFStringRef             interface;
+               CFMutableDictionaryRef  newDNS;
+               CFNumberRef             num;
+               CFArrayRef              searchDomains;
+               CFDictionaryRef         service;
+               CFStringRef             serviceID;
+
+               serviceID = CFArrayGetValueAtIndex(order, i);
+               service = CFDictionaryGetValue(services, serviceID);
+               if (!isA_CFDictionary(service)) {
+                       // if no service
+                       continue;
+               }
+
+               dns = CFDictionaryGetValue(service, kSCEntNetDNS);
+               if (!isA_CFDictionary(dns)) {
+                       // if no DNS
+                       continue;
+               }
+
+               interface = CFDictionaryGetValue(dns, kSCPropInterfaceName);
+               if (interface == NULL) {
+                       // if no [scoped] interface
+                       continue;
+               }
+               if (CFSetContainsValue(seen, interface)) {
+                       // if we've already processed this [scoped] interface
+                       continue;
+               }
+               CFSetSetValue(seen, interface);
+
+               if ((_SC_cfstring_to_cstring(interface,
+                                            if_name,
+                                            sizeof(if_name),
+                                            kCFStringEncodingASCII) == NULL) ||
+                   ((if_index = if_nametoindex(if_name)) == 0)) {
+                       // if interface index not available
+                       continue;
+               }
+
+               // add [scoped] resolver entry
+               newDNS = CFDictionaryCreateMutableCopy(NULL, 0, dns);
+
+               // set search list
+               searchDomains = extract_search_domains(newDNS, NULL);
+               if (searchDomains != NULL) {
+                       CFDictionarySetValue(newDNS, kSCPropNetDNSSearchDomains, searchDomains);
+                       CFRelease(searchDomains);
+               }
+
+               // set if_index
+               num = CFNumberCreate(NULL, kCFNumberIntType, &if_index);
+               CFDictionarySetValue(newDNS, CFSTR("*IF_INDEX*"), num);
+               CFRelease(num);
+
+               // set "scoped" flag
+               flags = DNS_RESOLVER_FLAGS_SCOPED;
+               num = CFNumberCreate(NULL, kCFNumberSInt32Type, &flags);
+               CFDictionarySetValue(newDNS, CFSTR("*FLAGS*"), num);
+               CFRelease(num);
+
+               // remove keys we don't want in a [scoped] resolver
+               CFDictionaryRemoveValue(newDNS, kSCPropNetDNSSupplementalMatchDomains);
+               CFDictionaryRemoveValue(newDNS, kSCPropNetDNSSupplementalMatchOrders);
+
+               add_resolver(scoped, newDNS);
+               CFRelease(newDNS);
+       }
+
+       CFRelease(seen);
+       CFRelease(order);
+       return;
+}
+
+
+static void
+add_default_resolver(CFMutableArrayRef resolvers,
+                    CFDictionaryRef    defaultResolver,
+                    Boolean            *orderAdded,
+                    CFArrayRef         *searchDomains)
+{
+       CFMutableDictionaryRef  myDefault;
+       uint32_t                myOrder = DEFAULT_SEARCH_ORDER;
+       CFNumberRef             order;
+
+       if (defaultResolver == NULL) {
+               myDefault = CFDictionaryCreateMutable(NULL,
+                                                     0,
+                                                     &kCFTypeDictionaryKeyCallBacks,
+                                                     &kCFTypeDictionaryValueCallBacks);
+       } else {
+               myDefault = CFDictionaryCreateMutableCopy(NULL, 0, defaultResolver);
+       }
+
+       // ensure that the default resolver has a search order
+
+       order = CFDictionaryGetValue(myDefault, kSCPropNetDNSSearchOrder);
+       if (!isA_CFNumber(order) ||
+           !CFNumberGetValue(order, kCFNumberIntType, &myOrder)) {
+               myOrder = DEFAULT_SEARCH_ORDER;
+               order = CFNumberCreate(NULL, kCFNumberIntType, &myOrder);
+               CFDictionarySetValue(myDefault, kSCPropNetDNSSearchOrder, order);
+               CFRelease(order);
+               *orderAdded = TRUE;
+       }
+
+       // extract the "search" domain list for the default resolver (and
+       // any supplemental resolvers)
+
+       *searchDomains = extract_search_domains(myDefault, resolvers);
+
+       // add the default resolver
+
+       add_resolver(resolvers, myDefault);
+       CFRelease(myDefault);
        return;
 }
 
@@ -803,151 +970,228 @@ create_resolver(CFDictionaryRef dns)
                }
        }
 
+       // process interface index
+       num = CFDictionaryGetValue(dns, CFSTR("*IF_INDEX*"));
+       if (isA_CFNumber(num)) {
+               int     if_index;
+
+               if (CFNumberGetValue(num, kCFNumberIntType, &if_index)) {
+                       _dns_resolver_set_if_index(&_resolver, if_index);
+               }
+       }
+
+       // process flags
+       num = CFDictionaryGetValue(dns, CFSTR("*FLAGS*"));
+       if (isA_CFNumber(num)) {
+               uint32_t        flags;
+
+               if (CFNumberGetValue(num, kCFNumberSInt32Type, &flags)) {
+                       _dns_resolver_set_flags(&_resolver, flags);
+               }
+       }
+
        return _resolver;
 }
 
 
-__private_extern__
-void
-dns_configuration_set(CFDictionaryRef   defaultResolver,
-                     CFDictionaryRef   services,
-                     CFArrayRef        serviceOrder,
-                     CFArrayRef        multicastResolvers,
-                     CFArrayRef        privateResolvers)
+static __inline__ Boolean
+isScopedDNS(CFDictionaryRef dns)
 {
-       CFIndex                 i;
-       CFMutableDictionaryRef  myDefault;
-       uint32_t                myOrder         = DEFAULT_SEARCH_ORDER;
-       Boolean                 myOrderAdded    = FALSE;
-       CFIndex                 n_supplemental;
-       CFNumberRef             order;
-       dns_create_resolver_t   resolver;
-       CFMutableArrayRef       supplemental;
+       uint32_t        flags;
+       CFNumberRef     num;
+
+       if ((dns != NULL) &&
+           CFDictionaryGetValueIfPresent(dns, CFSTR("*FLAGS*"), (const void **)&num) &&
+           (num != NULL) &&
+           CFNumberGetValue(num, kCFNumberSInt32Type, &flags) &&
+           ((flags & DNS_RESOLVER_FLAGS_SCOPED) != 0)) {
+               return TRUE;
+       }
 
-#ifdef SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
-       CFStringRef             myDomain        = NULL;
-       CFArrayRef              search;
-#endif // SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
+       return FALSE;
+}
 
-       if (defaultResolver == NULL) {
-               myDefault = CFDictionaryCreateMutable(NULL,
-                                                     0,
-                                                     &kCFTypeDictionaryKeyCallBacks,
-                                                     &kCFTypeDictionaryValueCallBacks);
-       } else {
-               myDefault = CFDictionaryCreateMutableCopy(NULL, 0, defaultResolver);
 
-               // ensure that the default resolver has a search order
+static CFComparisonResult
+compareDomain(const void *val1, const void *val2, void *context)
+{
+       CFDictionaryRef         dns1    = (CFDictionaryRef)val1;
+       CFDictionaryRef         dns2    = (CFDictionaryRef)val2;
+       CFStringRef             domain1;
+       CFStringRef             domain2;
+       CFArrayRef              labels1 = NULL;
+       CFArrayRef              labels2 = NULL;
+       CFIndex                 n1;
+       CFIndex                 n2;
+       CFComparisonResult      result;
+       Boolean                 rev1;
+       Boolean                 rev2;
+       Boolean                 scoped1;
+       Boolean                 scoped2;
+
+       // "default" domains sort before "supplemental" domains
+       domain1 = CFDictionaryGetValue(dns1, kSCPropNetDNSDomainName);
+       domain2 = CFDictionaryGetValue(dns2, kSCPropNetDNSDomainName);
+       if (domain1 == NULL) {
+               return kCFCompareLessThan;
+       } else if (domain2 == NULL) {
+               return kCFCompareGreaterThan;
+       }
+
+       // sort non-scoped before scoped
+       scoped1 = isScopedDNS(dns1);
+       scoped2 = isScopedDNS(dns2);
+       if (scoped1 != scoped2) {
+               if (!scoped1) {
+                       return kCFCompareLessThan;
+               } else {
+                       return kCFCompareGreaterThan;
+               }
+       }
+
+       // must have domain names for any further comparisons
+       if ((domain1 == NULL) || (domain2 == NULL)) {
+               return kCFCompareEqualTo;
+       }
 
-               order = CFDictionaryGetValue(myDefault, kSCPropNetDNSSearchOrder);
-               if (!isA_CFNumber(order) ||
-                   !CFNumberGetValue(order, kCFNumberIntType, &myOrder)) {
-                       myOrderAdded = TRUE;
-                       myOrder = DEFAULT_SEARCH_ORDER;
-                       order = CFNumberCreate(NULL, kCFNumberIntType, &myOrder);
-                       CFDictionarySetValue(myDefault, kSCPropNetDNSSearchOrder, order);
-                       CFRelease(order);
+       // forward (A, AAAA) domains sort before reverse (PTR) domains
+       rev1 = CFStringHasSuffix(domain1, CFSTR(".arpa"));
+       rev2 = CFStringHasSuffix(domain2, CFSTR(".arpa"));
+       if (rev1 != rev2) {
+               if (rev1) {
+                       return kCFCompareGreaterThan;
+               } else {
+                       return kCFCompareLessThan;
                }
        }
 
-       // establish list of supplemental resolvers
+       labels1 = CFStringCreateArrayBySeparatingStrings(NULL, domain1, CFSTR("."));
+       n1 = CFArrayGetCount(labels1);
 
-       supplemental = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       labels2 = CFStringCreateArrayBySeparatingStrings(NULL, domain2, CFSTR("."));
+       n2 = CFArrayGetCount(labels2);
 
-       // identify search[] list and/or domain name
+       while ((n1 > 0) && (n2 > 0)) {
+               CFStringRef     label1  = CFArrayGetValueAtIndex(labels1, --n1);
+               CFStringRef     label2  = CFArrayGetValueAtIndex(labels2, --n2);
 
-#ifdef SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
-       search = CFDictionaryGetValue(myDefault, kSCPropNetDNSSearchDomains);
-       if (isA_CFArray(search) && (CFArrayGetCount(search) > 0)) {
-               myDomain = CFArrayGetValueAtIndex(search, 0);
-               myDomain = isA_CFString(myDomain);
+               // compare domain labels
+               result = CFStringCompare(label1, label2, kCFCompareCaseInsensitive);
+               if (result != kCFCompareEqualTo) {
+                       goto done;
+               }
        }
 
-       if (myDomain == NULL) {
-               myDomain = CFDictionaryGetValue(myDefault, kSCPropNetDNSDomainName);
-               myDomain = isA_CFString(myDomain);
+       // longer labels (corp.apple.com) sort before shorter labels (apple.com)
+       if (n1 > n2) {
+               result = kCFCompareLessThan;
+               goto done;
+       } else if (n1 < n2) {
+               result = kCFCompareGreaterThan;
+               goto done;
        }
 
-       // add match for default domain
+       // sort by search order
+       result = compareBySearchOrder(val1, val2, context);
 
-       if (myDomain != NULL) {
-               CFMutableDictionaryRef  mySupplemental;
+    done :
 
-               mySupplemental = CFDictionaryCreateMutableCopy(NULL, 0, myDefault);
-               CFDictionarySetValue   (mySupplemental, kSCPropNetDNSDomainName, myDomain);
-               CFDictionaryRemoveValue(mySupplemental, kSCPropNetDNSSearchDomains);
-               CFDictionaryRemoveValue(mySupplemental, kSCPropNetDNSSupplementalMatchDomains);
-               CFDictionaryRemoveValue(mySupplemental, kSCPropNetDNSSupplementalMatchOrders);
-               add_resolver(supplemental, mySupplemental);
-               CFRelease(mySupplemental);
-       }
-#endif // SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
+       if (labels1 != NULL) CFRelease(labels1);
+       if (labels2 != NULL) CFRelease(labels2);
+       return result;
+}
 
-       // collect (and add) any supplemental resolver configurations
 
-       add_supplemental_resolvers(supplemental, services, serviceOrder);
+__private_extern__
+void
+dns_configuration_set(CFDictionaryRef   defaultResolver,
+                     CFDictionaryRef   services,
+                     CFArrayRef        serviceOrder,
+                     CFArrayRef        multicastResolvers,
+                     CFArrayRef        privateResolvers)
+{
+       CFIndex                 i;
+       CFMutableDictionaryRef  myDefault;
+       Boolean                 myOrderAdded    = FALSE;
+       CFArrayRef              mySearchDomains = NULL;
+       CFIndex                 n_resolvers;
+       CFMutableArrayRef       resolvers;
+
+       // establish list of resolvers
+
+       resolvers = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       // collect (and add) any "supplemental" resolver configurations
+
+       add_supplemental_resolvers(resolvers, services, serviceOrder);
 
        // collect (and add) any "private" resolver configurations
 
-       add_private_resolvers(supplemental, privateResolvers);
+       add_private_resolvers(resolvers, privateResolvers);
 
-       // update the "search" list
+       // add the "default" resolver
 
-       update_search_domains(&myDefault, supplemental);
+       add_default_resolver(resolvers, defaultResolver, &myOrderAdded, &mySearchDomains);
 
        // collect (and add) any "multicast" resolver configurations
 
-       add_multicast_resolvers(supplemental, multicastResolvers);
+       add_multicast_resolvers(resolvers, multicastResolvers);
 
-       // check if the "match for default domain" (above) is really needed
+       // collect (and add) any "scoped" resolver configurations
 
-#ifdef SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
-       if (myDomain != NULL) {
-               Boolean sharedDomain    = FALSE;
+       add_scoped_resolvers(resolvers, services, serviceOrder);
 
-               n_supplemental = CFArrayGetCount(supplemental);
-               for (i = 1; i < n_supplemental; i++) {
-                       CFStringRef     domain;
-                       CFDictionaryRef mySupplemental;
+       // sort resolvers
 
-                       mySupplemental = CFArrayGetValueAtIndex(supplemental, i);
-                       domain = CFDictionaryGetValue(mySupplemental, kSCPropNetDNSDomainName);
-                       if (isA_CFString(domain)) {
-                               if (CFEqual(myDomain, domain)) {
-                                       sharedDomain = TRUE;
-                                       break;
-                               }
+       n_resolvers = CFArrayGetCount(resolvers);
+       if (n_resolvers > 1) {
+               CFArraySortValues(resolvers, CFRangeMake(0, n_resolvers), compareDomain, NULL);
+       }
 
-                               if (CFStringHasSuffix(myDomain, domain)) {
-                                       CFIndex dotIndex;
+       // cleanup
 
-                                       dotIndex = CFStringGetLength(myDomain) - CFStringGetLength(domain) - 1;
-                                       if (dotIndex > 0) {
-                                               UniChar dot;
+       for (i = n_resolvers; --i > 0; ) {
+               CFDictionaryRef resolver;
 
-                                               dot = CFStringGetCharacterAtIndex(myDomain, dotIndex);
-                                               if (dot == (UniChar)'.') {
-                                                       sharedDomain = TRUE;
-                                                       break;
-                                               }
-                                       }
-                               }
-                       }
+               resolver = CFArrayGetValueAtIndex(resolvers, i);
+               if (!CFDictionaryContainsKey(resolver, kSCPropNetDNSDomainName) &&
+                   !CFDictionaryContainsKey(resolver, kSCPropNetDNSSearchDomains) &&
+                   !CFDictionaryContainsKey(resolver, kSCPropNetDNSServerAddresses)) {
+                       // remove empty resolver
+                       CFArrayRemoveValueAtIndex(resolvers, i);
+                       n_resolvers--;
                }
+       }
 
-               if (!sharedDomain) {
-                       // if the default resolver domain name is not shared
-                       CFArrayRemoveValueAtIndex(supplemental, 0);
+       // update the default resolver
+
+       myDefault = CFDictionaryCreateMutableCopy(NULL,
+                                                 0,
+                                                 CFArrayGetValueAtIndex(resolvers, 0));
+       if (mySearchDomains != NULL) {
+               // add search domains to the default resolver
+               CFDictionarySetValue(myDefault, kSCPropNetDNSSearchDomains, mySearchDomains);
+               CFRelease(mySearchDomains);
+       }
+       if (myOrderAdded && (n_resolvers > 1)) {
+               CFDictionaryRef resolver;
+
+               resolver = CFArrayGetValueAtIndex(resolvers, 1);
+               if (CFDictionaryContainsKey(resolver, kSCPropNetDNSDomainName) ||
+                   isScopedDNS(resolver)) {
+                       // if not a supplemental "default" resolver (a domain name is
+                       // present) or a if it's a scoped resolver
+                       CFDictionaryRemoveValue(myDefault, kSCPropNetDNSSearchOrder);
                }
        }
-#endif // SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
+       CFArraySetValueAtIndex(resolvers, 0, myDefault);
+       CFRelease(myDefault);
 
        // establish resolver configuration
 
-       n_supplemental = CFArrayGetCount(supplemental);
-       if ((defaultResolver == NULL) && (n_supplemental == 0)) {
+       if ((defaultResolver == NULL) && (n_resolvers <= 1)) {
                /*
-                * if no default or supplemental resolvers
+                * if no default and no supplemental/scoped resolvers
                 */
                if (!_dns_configuration_store(NULL)) {
                        SCLog(TRUE, LOG_ERR, CFSTR("dns_configuration_set: could not store configuration"));
@@ -956,28 +1200,20 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
                dns_create_config_t     _config;
 
                /*
-                * if default and/or supplemental resolvers are defined
+                * if default and/or supplemental/scoped resolvers are defined
                 */
                _config = _dns_configuration_create();
 
-               // add [default] resolver
-
-               if ((n_supplemental == 0) && myOrderAdded) {
-                       CFDictionaryRemoveValue(myDefault, kSCPropNetDNSSearchOrder);
-               }
-               resolver = create_resolver(myDefault);
-               _dns_configuration_add_resolver(&_config, resolver);
-               _dns_resolver_free(&resolver);
-
-               // add [supplemental] resolvers
+               // add resolvers
 
-               for (i = 0; i < n_supplemental; i++) {
-                       CFDictionaryRef supplementalResolver;
+               for (i = 0; i < n_resolvers; i++) {
+                       CFDictionaryRef         resolver;
+                       dns_create_resolver_t   _resolver;
 
-                       supplementalResolver = CFArrayGetValueAtIndex(supplemental, i);
-                       resolver = create_resolver(supplementalResolver);
-                       _dns_configuration_add_resolver(&_config, resolver);
-                       _dns_resolver_free(&resolver);
+                       resolver = CFArrayGetValueAtIndex(resolvers, i);
+                       _resolver = create_resolver(resolver);
+                       _dns_configuration_add_resolver(&_config, _resolver);
+                       _dns_resolver_free(&_resolver);
                }
 
 #if    !TARGET_OS_IPHONE
@@ -995,9 +1231,7 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
                _dns_configuration_free(&_config);
        }
 
-       CFRelease(myDefault);
-       CFRelease(supplemental);
-
+       CFRelease(resolvers);
        return;
 }
 
@@ -1060,12 +1294,10 @@ dns_configuration_monitor(SCDynamicStoreRef store, SCDynamicStoreCallBack callou
                return;
        }
 
-       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;
-       }
+       mp = _SC_CFMachPortCreateWithPort("IPMonitor/dns_configuration",
+                                         notify_port,
+                                         dns_configuration_changed,
+                                         NULL);
 
        rls = CFMachPortCreateRunLoopSource(NULL, mp, -1);
        if (rls == NULL) {
@@ -1103,7 +1335,6 @@ dns_configuration_init(CFBundleRef bundle)
 
 
 #ifdef MAIN
-#undef MAIN
 
 static void
 split(const void * key, const void * value, void * context)
@@ -1116,11 +1347,63 @@ split(const void * key, const void * value, void * context)
        components = CFStringCreateArrayBySeparatingStrings(NULL, (CFStringRef)key, CFSTR("/"));
        service_id = CFArrayGetValueAtIndex(components, 3);
        entity_id  = CFArrayGetValueAtIndex(components, 4);
-       state_dict = CFDictionaryCreateMutable(NULL,
-                                              0,
-                                              &kCFTypeDictionaryKeyCallBacks,
-                                              &kCFTypeDictionaryValueCallBacks);
-       CFDictionarySetValue(state_dict, entity_id, (CFDictionaryRef)value);
+       state_dict = (CFMutableDictionaryRef)CFDictionaryGetValue(context, service_id);
+       if (state_dict != NULL) {
+               state_dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
+       } else {
+               state_dict = CFDictionaryCreateMutable(NULL,
+                                                      0,
+                                                      &kCFTypeDictionaryKeyCallBacks,
+                                                      &kCFTypeDictionaryValueCallBacks);
+       }
+
+       if (CFEqual(entity_id, kSCEntNetIPv4) ||
+           CFEqual(entity_id, kSCEntNetIPv6)) {
+               CFStringRef     interface;
+
+               interface = CFDictionaryGetValue((CFDictionaryRef)value, kSCPropInterfaceName);
+               if (interface != NULL) {
+                       CFDictionaryRef         dns;
+                       CFMutableDictionaryRef  new_dns;
+
+                       dns = CFDictionaryGetValue(state_dict, kSCEntNetDNS);
+                       if (dns != NULL) {
+                               new_dns = CFDictionaryCreateMutableCopy(NULL, 0, dns);
+                       } else {
+                               new_dns = CFDictionaryCreateMutable(NULL,
+                                                               0,
+                                                               &kCFTypeDictionaryKeyCallBacks,
+                                                               &kCFTypeDictionaryValueCallBacks);
+                       }
+                       CFDictionarySetValue(new_dns, kSCPropInterfaceName, interface);
+                       CFDictionarySetValue(state_dict, kSCEntNetDNS, new_dns);
+                       CFRelease(new_dns);
+               }
+       } else if (CFEqual(entity_id, kSCEntNetDNS)) {
+               CFDictionaryRef dns;
+
+               dns = CFDictionaryGetValue(state_dict, kSCEntNetDNS);
+               if (dns != NULL) {
+                       CFStringRef     interface;
+
+                       interface = CFDictionaryGetValue(dns, kSCPropInterfaceName);
+                       if (interface != NULL) {
+                               CFMutableDictionaryRef  new_dns;
+
+                               new_dns = CFDictionaryCreateMutableCopy(NULL, 0, (CFDictionaryRef)value);
+                               CFDictionarySetValue(new_dns, kSCPropInterfaceName, interface);
+                               CFDictionarySetValue(state_dict, kSCEntNetDNS, new_dns);
+                               CFRelease(new_dns);
+                       } else {
+                               CFDictionarySetValue(state_dict, kSCEntNetDNS, (CFDictionaryRef)value);
+                       }
+               } else {
+                       CFDictionarySetValue(state_dict, kSCEntNetDNS, (CFDictionaryRef)value);
+               }
+       } else {
+               CFDictionarySetValue(state_dict, entity_id, (CFDictionaryRef)value);
+       }
+
        CFDictionarySetValue((CFMutableDictionaryRef)context, service_id, state_dict);
        CFRelease(state_dict);
        CFRelease(components);
@@ -1150,12 +1433,24 @@ main(int argc, char **argv)
 
        store = SCDynamicStoreCreate(NULL, CFSTR("TEST"), NULL, NULL);
 
-       // get DNS entities
+       // get IPv4, IPv6, and DNS entities
+       patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPv4);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPv6);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
        pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                              kSCDynamicStoreDomainState,
                                                              kSCCompAnyRegex,
                                                              kSCEntNetDNS);
-       patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
        entities = SCDynamicStoreCopyMultiple(store, NULL, patterns);
index 5aaf1ea95fd981759e5da13edbbeac3873f725f7..82cd44bf81846c674691d6c3d12cbca47b89c39a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2009 Apple Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2011 Apple Inc.  All Rights Reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <string.h>
 #include <stdio.h>
 #include <sys/fcntl.h>
+#include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <net/route.h>
 #include <net/if.h>
 #include <net/if_dl.h>
 #include <netinet/in.h>
+#include <netinet/icmp6.h>
+#include <netinet6/in6_var.h>
+#include <netinet6/nd6.h>
 #include <arpa/inet.h>
 #include <sys/sysctl.h>
 #include <limits.h>
@@ -125,6 +129,7 @@ enum {
 
 #include "set-hostname.h"
 #include "dns-configuration.h"
+#include "proxy-configuration.h"
 #if    !TARGET_OS_IPHONE
 #include "smb-configuration.h"
 #endif /* !TARGET_OS_IPHONE */
@@ -198,6 +203,7 @@ static boolean_t            S_netboot = FALSE;
 /* is scoped routing enabled? */
 #ifdef RTF_IFSCOPE
 static boolean_t               S_scopedroute = FALSE;
+static boolean_t               S_scopedroute_v6 = FALSE;
 #endif /* RTF_IFSCOPE */
 
 /* dictionary to hold per-service state: key is the serviceID */
@@ -220,7 +226,6 @@ static CFStringRef          S_state_global_dns = NULL;
 static CFStringRef             S_state_global_proxies = 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_service_prefix = NULL;
 
 static CFStringRef             S_multicast_resolvers = NULL;
@@ -236,7 +241,6 @@ static boolean_t            S_append_state = FALSE;
 #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
@@ -422,6 +426,45 @@ S_is_network_boot()
     return (netboot);
 }
 
+static __inline__ int
+inet6_dgram_socket()
+{
+    return (socket(AF_INET6, SOCK_DGRAM, 0));
+}
+
+#ifdef SIOCDRADD_IN6
+static int
+siocdradd_in6(int s, int if_index, const struct in6_addr * addr, u_char flags)
+{
+    struct in6_defrouter       dr;
+    struct sockaddr_in6 *      sin6;
+
+    bzero(&dr, sizeof(dr));
+    sin6 = &dr.rtaddr;
+    sin6->sin6_len = sizeof(struct sockaddr_in6);
+    sin6->sin6_family = AF_INET6;
+    sin6->sin6_addr = *addr;
+    dr.flags = flags;
+    dr.if_index = if_index;
+    return (ioctl(s, SIOCDRADD_IN6, &dr));
+}
+
+static int
+siocdrdel_in6(int s, int if_index, const struct in6_addr * addr)
+{
+    struct in6_defrouter       dr;
+    struct sockaddr_in6 *      sin6;
+
+    bzero(&dr, sizeof(dr));
+    sin6 = &dr.rtaddr;
+    sin6->sin6_len = sizeof(struct sockaddr_in6);
+    sin6->sin6_family = AF_INET6;
+    sin6->sin6_addr = *addr;
+    dr.if_index = if_index;
+    return (ioctl(s, SIOCDRDEL_IN6, &dr));
+}
+#endif /* SIOCDRADD_IN6 */
+
 #ifdef RTF_IFSCOPE
 static boolean_t
 S_is_scoped_routing_enabled()
@@ -437,6 +480,21 @@ S_is_scoped_routing_enabled()
     }
     return (scopedroute);
 }
+
+static boolean_t
+S_is_scoped_v6_routing_enabled()
+{
+    int            scopedroute_v6      = 0;
+    size_t  len                        = sizeof(scopedroute_v6);
+
+    if ((sysctlbyname("net.inet6.ip6.scopedroute",
+                     &scopedroute_v6, &len,
+                     NULL, 0) == -1)
+       && (errno != ENOENT)) {
+       SCLog(TRUE, LOG_ERR, CFSTR("sysctlbyname() failed: %s"), strerror(errno));
+    }
+    return (scopedroute_v6);
+}
 #endif /* RTF_IFSCOPE */
 
 static void
@@ -1175,7 +1233,9 @@ IPv4RouteListCreateWithDictionary(IPv4RouteListRef routes,
     unsigned int       ifindex;
     char               ifn[IFNAMSIZ];
     struct in_addr     mask = { 0 };
-    int                        n;
+    int                        n = 0;
+    boolean_t          add_default = FALSE;
+    boolean_t          add_subnet = FALSE;
     IPv4RouteRef       r;
     struct in_addr     subnet = { 0 };
     struct in_addr     router = { 0 };
@@ -1200,13 +1260,13 @@ IPv4RouteListCreateWithDictionary(IPv4RouteListRef routes,
                       &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) {
+           add_subnet = TRUE;
            n++;
        }
     }
@@ -1223,7 +1283,7 @@ IPv4RouteListCreateWithDictionary(IPv4RouteListRef routes,
         * 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) {
+           && mask.s_addr != INADDR_BROADCAST) {
            flags |= kRouteIsDirectToInterfaceFlag;
        }
        if (primaryRank != NULL) {
@@ -1238,11 +1298,16 @@ IPv4RouteListCreateWithDictionary(IPv4RouteListRef routes,
            flags |= kRouteChooseFirstFlag;
        }
     }
-    if (n > 1 && (flags & kRouteIsDirectToInterfaceFlag) == 0
+    if (add_subnet && (flags & kRouteIsDirectToInterfaceFlag) == 0
        && subnet.s_addr != subnet_addr(router, mask).s_addr) {
        flags |= kRouteIsNotSubnetLocalFlag;
     }
 
+    if (strncmp(ifn, "lo0", sizeof(ifn)) != 0) {
+       add_default = TRUE;
+       n++;
+    }
+
     if (routes == NULL || routes->size < n) {
        routes = (IPv4RouteListRef)malloc(IPv4RouteListComputeSize(n));
        routes->size = n;
@@ -1253,22 +1318,23 @@ IPv4RouteListCreateWithDictionary(IPv4RouteListRef routes,
     /* 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) {
+    if (add_default) {
+       /* 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 {
+       }
+       else {
            r->gateway = addr;
+       }
+       r++;
     }
-    r++;
-    n--;
 
     /* add the subnet route */
-    if (n > 0) {
+    if (add_subnet) {
        r->ifindex = ifindex;
        r->gateway = addr;
        r->dest = subnet;
@@ -1413,6 +1479,105 @@ service_dict_get(CFStringRef serviceID, CFStringRef entity)
     return (CFDictionaryGetValue(service_dict, entity));
 }
 
+static boolean_t
+ipv6_service_dict_set(CFStringRef serviceID, CFDictionaryRef new_val)
+{
+#ifdef SIOCDRADD_IN6
+    int                        if_index;
+    char               ifn[IFNAMSIZ];
+    CFStringRef                new_router = NULL;
+    char               ntopbuf[INET6_ADDRSTRLEN];
+    CFDictionaryRef    old_val = NULL;
+    CFStringRef                old_router = NULL;
+    struct in6_addr    router_ip;
+    int                        s = -1;
+
+    ifn[0] = '\0';
+    old_val = service_dict_get(serviceID, kSCEntNetIPv6);
+    if (old_val != NULL) {
+       plist_get_cstring(old_val, kSCPropInterfaceName, ifn, sizeof(ifn));
+       old_router = CFDictionaryGetValue(old_val, kSCPropNetIPv6Router);
+    }
+    if (ifn[0] == '\0') {
+       if (new_val == NULL
+           || plist_get_cstring(new_val, kSCPropInterfaceName,
+                                ifn, sizeof(ifn)) == FALSE) {
+           /* no InterfaceName property, ignore it */
+           goto done;
+       }
+    }
+    if_index = if_nametoindex(ifn);
+    if (if_index == 0) {
+       goto done;
+    }
+    s = inet6_dgram_socket();
+    if (s < 0) {
+       syslog(LOG_ERR,
+              "IPMonitor: ipv6_service_dict_set: socket failed, %s",
+              strerror(errno));
+       goto done;
+    }
+    if (new_val != NULL) {
+       new_router = CFDictionaryGetValue(new_val, kSCPropNetIPv6Router);
+    }
+    if (old_router != NULL
+       && (new_router == NULL || CFEqual(old_router, new_router) == FALSE)) {
+       /* remove the old Router */
+       if (cfstring_to_ip6(old_router, &router_ip)) {
+           if (IN6_IS_ADDR_LINKLOCAL(&router_ip)) {
+               /* scope it */
+               router_ip.__u6_addr.__u6_addr16[1] = htons(if_index);
+           }
+           if (siocdrdel_in6(s, if_index, &router_ip) < 0) {
+               if (errno != EINVAL) {
+                   syslog(LOG_ERR,
+                          "IPMonitor: siocdrdel_in6(%s, %s) failed, %s",
+                          ifn,
+                          inet_ntop(AF_INET6, &router_ip,
+                                    ntopbuf, sizeof(ntopbuf)),
+                          strerror(errno));
+               }
+           }
+           else if (S_IPMonitor_debug & kDebugFlag1) {
+               syslog(LOG_NOTICE,
+                      "IPMonitor: %s removed default route %s",
+                      ifn,
+                      inet_ntop(AF_INET6, &router_ip,
+                                ntopbuf, sizeof(ntopbuf)));
+           }
+       }
+    }
+    /* add the new Router */
+    if (cfstring_to_ip6(new_router, &router_ip)) {
+       if (IN6_IS_ADDR_LINKLOCAL(&router_ip)) {
+           /* scope it */
+           router_ip.__u6_addr.__u6_addr16[1] = htons(if_index);
+       }
+       if (siocdradd_in6(s, if_index, &router_ip, 0) < 0) {
+           if (errno != EINVAL) {
+               syslog(LOG_ERR,
+                      "IPMonitor: siocdradd_in6(%s, %s) failed, %s",
+                      ifn,
+                      inet_ntop(AF_INET6, &router_ip,
+                                ntopbuf, sizeof(ntopbuf)),
+                      strerror(errno));
+           }
+       }
+       else if (S_IPMonitor_debug & kDebugFlag1) {
+           syslog(LOG_NOTICE,
+                  "IPMonitor: %s added default route %s",
+                  ifn,
+                  inet_ntop(AF_INET6, &router_ip,
+                            ntopbuf, sizeof(ntopbuf)));
+       }
+    }
+    close(s);
+
+ done:
+#endif /* SIOCDRADD_IN6 */
+    return (service_dict_set(serviceID, kSCEntNetIPv6, new_val));
+}
+
 #define        ALLOW_EMPTY_STRING      0x1
 
 static CFTypeRef
@@ -1644,8 +1809,9 @@ get_ipv6_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
        }
     }
     new_dict = dict;
+
  done:
-    changed = service_dict_set(serviceID, kSCEntNetIPv6, new_dict);
+    changed = ipv6_service_dict_set(serviceID, new_dict);
     if (new_dict == NULL) {
        /* clean up the rank too */
        CFDictionaryRemoveValue(S_ipv6_service_rank_dict, serviceID);
@@ -1654,25 +1820,6 @@ get_ipv6_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
     return (changed);
 }
 
-static boolean_t
-dns_has_supplemental(CFStringRef serviceID)
-{
-    CFDictionaryRef     dns_dict;
-    CFDictionaryRef     service_dict;
-
-    service_dict = CFDictionaryGetValue(S_service_state_dict, serviceID);
-    if (service_dict == NULL) {
-       return FALSE;
-    }
-
-    dns_dict = CFDictionaryGetValue(service_dict, kSCEntNetDNS);
-    if (dns_dict == NULL) {
-       return FALSE;
-    }
-
-    return CFDictionaryContainsKey(dns_dict, kSCPropNetDNSSupplementalMatchDomains);
-}
-
 static void
 accumulate_dns_servers(CFArrayRef in_servers, ProtocolFlags active_protos,
                       CFMutableArrayRef out_servers)
@@ -1704,14 +1851,13 @@ accumulate_dns_servers(CFArrayRef in_servers, ProtocolFlags active_protos,
            if ((active_protos & kProtocolFlagsIPv6) == 0
                && !IN6_IS_ADDR_LOOPBACK(&ipv6_addr)) {
                if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
-                   char        str[128];
+                   char        ntopbuf[INET6_ADDRSTRLEN];
 
-                   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);
+                          inet_ntop(AF_INET6, &ipv6_addr,
+                                    ntopbuf, sizeof(ntopbuf)));
                }
                continue;
            }
@@ -1765,9 +1911,12 @@ static boolean_t
 get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
-    ProtocolFlags              active_protos = kProtocolFlagsNone;
-    boolean_t                  changed = FALSE;
+    ProtocolFlags              active_protos   = kProtocolFlagsNone;
+    boolean_t                  changed         = FALSE;
     CFStringRef                        domain;
+    CFStringRef                        interface       = NULL;
+    CFDataRef                  ipv4;
+    CFDictionaryRef            ipv6;
     int                                i;
     struct {
        CFStringRef     key;
@@ -1789,32 +1938,56 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
     };
 
     if ((state_dict == NULL) && (setup_dict == NULL)) {
-       /* there is no DNS */
+       /* there is no DNS content */
        goto done;
     }
 
-    if (service_dict_get(serviceID, kSCEntNetIPv4) != NULL) {
+    ipv4 = (CFDataRef)service_dict_get(serviceID, kSCEntNetIPv4);
+    if (ipv4 != NULL) {
+       IPv4RouteListRef    routes;
+
        active_protos |= kProtocolFlagsIPv4;
+
+       routes = (IPv4RouteListRef)CFDataGetBytePtr(ipv4);
+       if (routes->count > 0) {
+           interface = CFStringCreateWithCString(NULL,
+                                                 routes->list[0].ifname,
+                                                 kCFStringEncodingASCII);
+       }
     }
-    if (service_dict_get(serviceID, kSCEntNetIPv6) != NULL) {
+
+    ipv6 = service_dict_get(serviceID, kSCEntNetIPv6);
+    if (ipv6 != NULL) {
        active_protos |= kProtocolFlagsIPv6;
+
+       if ((interface == NULL) &&
+           CFDictionaryGetValueIfPresent(ipv6,
+                                         kSCPropInterfaceName,
+                                         (const void **)&interface)) {
+               CFRetain(interface);
+       }
     }
-    /* 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 */
+           /* ... and no DNS content that we care about */
            goto done;
        }
+       setup_dict = NULL;
+    }
+
+    /* merge DNS configuration */
+    new_dict = CFDictionaryCreateMutable(NULL, 0,
+                                        &kCFTypeDictionaryKeyCallBacks,
+                                        &kCFTypeDictionaryValueCallBacks);
+
+    if (active_protos == kProtocolFlagsNone) {
        merge_dns_servers(new_dict,
                          my_CFDictionaryGetArray(state_dict,
                                                  kSCPropNetDNSServerAddresses),
                          NULL,
                          kProtocolFlagsIPv4 | kProtocolFlagsIPv6);
-       setup_dict = NULL;
     }
     else {
        merge_dns_servers(new_dict,
@@ -1833,6 +2006,7 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                         merge_list[i].flags,
                         merge_list[i].append);
     }
+
     for (i = 0; i < sizeof(pick_list)/sizeof(pick_list[0]); i++) {
        pick_prop(new_dict,
                  pick_list[i],
@@ -1854,11 +2028,16 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
            goto done;
        }
     }
+
     if (CFDictionaryGetCount(new_dict) == 0) {
        my_CFRelease(&new_dict);
        goto done;
     }
 
+    if (interface != NULL) {
+       CFDictionarySetValue(new_dict, kSCPropInterfaceName, interface);
+    }
+
     if (S_append_state) {
        /*
         * ensure any specified domain name (e.g. the domain returned by
@@ -1884,6 +2063,7 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
  done:
     changed = service_dict_set(serviceID, kSCEntNetDNS, new_dict);
     my_CFRelease(&new_dict);
+    my_CFRelease(&interface);
     return (changed);
 }
 
@@ -1908,13 +2088,22 @@ wpadURL_dhcp(CFDictionaryRef dhcp_options)
 
        data = DHCPInfoGetOptionData(dhcp_options, PROXY_AUTO_DISCOVERY_URL);
        if (data != NULL) {
-           CFURLRef    url;
+           CFURLRef    url;
+           const UInt8 *urlBytes;
+           CFIndex     urlLen;
+
+           urlBytes = CFDataGetBytePtr(data);
+           urlLen   = CFDataGetLength(data);
+           while ((urlLen > 0) && (urlBytes[urlLen - 1] == 0)) {
+               // remove trailing NUL
+               urlLen--;
+           }
 
-           url = CFURLCreateWithBytes(NULL,
-                                      CFDataGetBytePtr(data),
-                                      CFDataGetLength(data),
-                                      kCFStringEncodingUTF8,
-                                      NULL);
+           if (urlLen <= 0) {
+               return NULL;
+           }
+
+           url = CFURLCreateWithBytes(NULL, urlBytes, urlLen, kCFStringEncodingUTF8, NULL);
            if (url != NULL) {
                urlString = CFURLGetString(url);
                if (urlString != NULL) {
@@ -1950,8 +2139,20 @@ static boolean_t
 get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                    CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
-    boolean_t                  changed = FALSE;
-    CFMutableDictionaryRef     new_dict = NULL;
+    ProtocolFlags              active_protos   = kProtocolFlagsNone;
+    boolean_t                  changed         = FALSE;
+    CFStringRef                        interface       = NULL;
+    CFDataRef                  ipv4;
+    CFDictionaryRef            ipv6;
+    CFMutableDictionaryRef     new_dict        = NULL;
+    struct {
+       CFStringRef     key;
+       uint32_t        flags;
+       Boolean         append;
+    } merge_list[] = {
+       { kSCPropNetProxiesSupplementalMatchDomains,    ALLOW_EMPTY_STRING,     TRUE  },
+       { kSCPropNetProxiesSupplementalMatchOrders,     0,                      TRUE  },
+    };
     struct {
            CFStringRef key1;   /* an "enable" key */
            CFStringRef key2;
@@ -1965,18 +2166,52 @@ get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
            { kSCPropNetProxiesSOCKSEnable,     kSCPropNetProxiesSOCKSProxy,    kSCPropNetProxiesSOCKSPort      },
            { kSCPropNetProxiesProxyAutoConfigEnable,
              kSCPropNetProxiesProxyAutoConfigURLString,
-             NULL, },
+             kSCPropNetProxiesProxyAutoConfigJavaScript, },
            { kSCPropNetProxiesProxyAutoDiscoveryEnable,
              NULL,
              NULL, }
     };
 
-    if ((service_dict_get(serviceID, kSCEntNetIPv4) == NULL) &&
-       (service_dict_get(serviceID, kSCEntNetIPv6) == NULL)) {
-       /* there is no IPv4 nor IPv6 */
+    if ((state_dict == NULL) && (setup_dict == NULL)) {
+       /* there is no proxy content */
        goto done;
     }
 
+    ipv4 = (CFDataRef)service_dict_get(serviceID, kSCEntNetIPv4);
+    if (ipv4 != NULL) {
+       IPv4RouteListRef    routes;
+
+       active_protos |= kProtocolFlagsIPv4;
+
+       routes = (IPv4RouteListRef)CFDataGetBytePtr(ipv4);
+       if (routes->count > 0) {
+           interface = CFStringCreateWithCString(NULL,
+                                                 routes->list[0].ifname,
+                                                 kCFStringEncodingASCII);
+       }
+    }
+
+    ipv6 = service_dict_get(serviceID, kSCEntNetIPv6);
+    if (ipv6 != NULL) {
+       active_protos |= kProtocolFlagsIPv6;
+
+       if ((interface == NULL) &&
+           CFDictionaryGetValueIfPresent(ipv6,
+                                         kSCPropInterfaceName,
+                                         (const void **)&interface)) {
+               CFRetain(interface);
+           }
+    }
+
+    if (active_protos == kProtocolFlagsNone) {
+       /* there is no IPv4 nor IPv6 */
+       if (state_dict == NULL) {
+           /* ... and no proxy content that we care about */
+           goto done;
+       }
+       setup_dict = NULL;
+    }
+
     if ((setup_dict != NULL) && (state_dict != NULL)) {
        CFIndex                 i;
        CFMutableDictionaryRef  setup_copy;
@@ -1990,6 +2225,16 @@ get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
         * the "Setup:" keys and others from the "State:" keys.
         */
        new_dict   = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
+
+       for (i = 0; i < sizeof(merge_list)/sizeof(merge_list[0]); i++) {
+           merge_array_prop(new_dict,
+                            merge_list[i].key,
+                            state_dict,
+                            setup_dict,
+                            merge_list[i].flags,
+                            merge_list[i].append);
+       }
+
        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)) {
@@ -2024,11 +2269,6 @@ get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
        /* 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 if (setup_dict != NULL) {
        new_dict = CFDictionaryCreateMutableCopy(NULL, 0, setup_dict);
@@ -2037,6 +2277,15 @@ get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
        new_dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
     }
 
+    if ((new_dict != NULL) && (CFDictionaryGetCount(new_dict) == 0)) {
+       CFRelease(new_dict);
+       new_dict = NULL;
+    }
+
+    if ((new_dict != NULL) && (interface != NULL)) {
+       CFDictionarySetValue(new_dict, kSCPropInterfaceName, interface);
+    }
+
     /* process WPAD */
     if (new_dict != NULL) {
        CFDictionaryRef dhcp_options;
@@ -2071,9 +2320,19 @@ get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                CFStringRef     pacURL;
 
                pacURL = CFDictionaryGetValue(new_dict, kSCPropNetProxiesProxyAutoConfigURLString);
-               if (!isA_CFString(pacURL)) {
-                   /* if we don't like the PAC URL */
-                   pacEnabled = 0;
+               if (pacURL != NULL) {
+                   if (!isA_CFString(pacURL)) {
+                       /* if we don't like the PAC URL */
+                       pacEnabled = 0;
+                   }
+               } else {
+                   CFStringRef pacJS;
+
+                   pacJS = CFDictionaryGetValue(new_dict, kSCPropNetProxiesProxyAutoConfigJavaScript);
+                   if (!isA_CFString(pacJS)) {
+                       /* if we don't have (or like) the PAC JavaScript */
+                       pacEnabled = 0;
+                   }
                }
            }
 
@@ -2125,7 +2384,8 @@ get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
 
  done:
     changed = service_dict_set(serviceID, kSCEntNetProxies, new_dict);
-    if (new_dict != NULL) CFRelease(new_dict);
+    my_CFRelease(&new_dict);
+    my_CFRelease(&interface);
     return (changed);
 }
 
@@ -2140,7 +2400,9 @@ get_smb_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
     CFStringRef                        pick_list[] = {
        kSCPropNetSMBNetBIOSName,
        kSCPropNetSMBNetBIOSNodeType,
+#ifdef ADD_NETBIOS_SCOPE
        kSCPropNetSMBNetBIOSScope,
+#endif // ADD_NETBIOS_SCOPE
        kSCPropNetSMBWorkgroup,
     };
 
@@ -2283,10 +2545,6 @@ services_info_copy(SCDynamicStoreRef session, CFArrayRef service_list)
     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);
 
@@ -2305,13 +2563,13 @@ services_info_copy(SCDynamicStoreRef session, CFArrayRef service_list)
 static int                     rtm_seq = 0;
 
 static int
-ipv4_route_open_socket(void)
+route_open_socket(void)
 {
     int sockfd;
 
-    if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
+    if ((sockfd = socket(PF_ROUTE, SOCK_RAW, PF_ROUTE)) == -1) {
        SCLog(TRUE, LOG_NOTICE,
-             CFSTR("IPMonitor: ipv4_route_open_socket: socket failed, %s"),
+             CFSTR("IPMonitor: route_open_socket: socket failed, %s"),
              strerror(errno));
     }
     return (sockfd);
@@ -2468,10 +2726,8 @@ ipv6_route(int cmd, struct in6_addr gateway, struct in6_addr netaddr,
        /* add the scope id to the link local address */
        gateway.__u6_addr.__u6_addr16[1] = (uint16_t)htons(index);
     }
-    if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
-       SCLog(TRUE, LOG_NOTICE,
-             CFSTR("IPMonitor ipv6_route: open routing socket failed, %s"),
-             strerror(errno));
+    sockfd = route_open_socket();
+    if (sockfd == -1) {
        return (FALSE);
     }
     memset(&rtmsg, 0, sizeof(rtmsg));
@@ -2550,15 +2806,13 @@ ipv6_default_route_add(struct in6_addr router, char * ifname,
                       boolean_t is_direct)
 {
     if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
-       char    str[128];
-
-       str[0] = '\0';
+       char    ntopbuf[INET6_ADDRSTRLEN];
 
-       inet_ntop(AF_INET6, &router, str, sizeof(str));
        SCLog(TRUE, LOG_NOTICE,
              CFSTR("IPMonitor: IPv6 route add default"
                    " %s interface %s direct %d"),
-             str, ifname, is_direct);
+             inet_ntop(AF_INET6, &router, ntopbuf, sizeof(ntopbuf)),
+             ifname, is_direct);
     }
     return (ipv6_route(RTM_ADD, router, S_ip6_zeros, S_ip6_zeros,
                       ifname, is_direct));
@@ -2587,6 +2841,39 @@ multicast_route_add(int sockfd)
                       gateway, 0));
 }
 
+#ifdef RTF_IFSCOPE
+static void
+set_ipv6_default_interface(char * ifname)
+{
+    struct in6_ndifreq ndifreq;
+    int                        sock;
+
+    bzero((char *)&ndifreq, sizeof(ndifreq));
+    if (ifname != NULL) {
+       strlcpy(ndifreq.ifname, ifname, sizeof(ndifreq.ifname));
+       ndifreq.ifindex = if_nametoindex(ifname);
+    } else {
+       strlcpy(ndifreq.ifname, "lo0", sizeof(ndifreq.ifname));
+       ndifreq.ifindex = 0;
+    }
+
+    sock = inet6_dgram_socket();
+    if (sock == -1) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR("IPMonitor: set_ipv6_default_interface: socket failed, %s"),
+             strerror(errno));
+       return;
+    }
+    if (ioctl(sock, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq) == -1) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR("IPMonitor: set_ipv6_default_interface: ioctl(SIOCSDEFIFACE_IN6) failed, %s"),
+             strerror(errno));
+    }
+    close(sock);
+    return;
+}
+#endif /* RTF_IFSCOPE */
+
 static void
 set_ipv6_router(struct in6_addr * router, char * ifname, boolean_t is_direct)
 {
@@ -2628,10 +2915,6 @@ set_dns(CFArrayRef val_search_domains,
        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);
-       }
-
        if (isA_CFArray(val_search_domains)) {
            SCPrint(TRUE, f, CFSTR("search"));
            n = CFArrayGetCount(val_search_domains);
@@ -2645,6 +2928,9 @@ set_dns(CFArrayRef val_search_domains,
            }
            SCPrint(TRUE, f, CFSTR("\n"));
        }
+       else if (isA_CFString(val_domain_name)) {
+               SCPrint(TRUE, f, CFSTR("domain %@\n"), val_domain_name);
+       }
 
        if (isA_CFArray(val_servers)) {
            n = CFArrayGetCount(val_servers);
@@ -2901,7 +3187,7 @@ update_ipv4(CFStringRef           primary,
     }
 
     bzero(&context, sizeof(context));
-    context.sockfd = ipv4_route_open_socket();
+    context.sockfd = route_open_socket();
     if (context.sockfd != -1) {
        if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
            if (S_ipv4_routelist == NULL) {
@@ -2954,6 +3240,7 @@ update_ipv6(CFDictionaryRef       service_info,
        }
     }
     if (ipv6_dict != NULL) {
+       CFArrayRef              addrs;
        CFMutableDictionaryRef  dict = NULL;
        CFStringRef             if_name = NULL;
        char                    ifn[IFNAMSIZ] = { '\0' };
@@ -2965,16 +3252,18 @@ update_ipv6(CFDictionaryRef     service_info,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
        val_router = CFDictionaryGetValue(ipv6_dict, kSCPropNetIPv6Router);
+       addrs = CFDictionaryGetValue(ipv6_dict,
+                                    kSCPropNetIPv6Addresses);
        if (val_router != NULL) {
-           CFArrayRef          addrs;
-
            /* no router if router is one of our IP addresses */
-           addrs = CFDictionaryGetValue(ipv6_dict,
-                                        kSCPropNetIPv6Addresses);
            is_direct = router_is_our_ipv6_address(val_router, addrs);
            CFDictionarySetValue(dict, kSCPropNetIPv6Router,
                                 val_router);
        }
+       else {
+           val_router = CFArrayGetValueAtIndex(addrs, 0);
+           is_direct = TRUE;
+       }
        if_name = CFDictionaryGetValue(ipv6_dict, kSCPropInterfaceName);
        if (if_name) {
            CFDictionarySetValue(dict,
@@ -2990,7 +3279,12 @@ update_ipv6(CFDictionaryRef      service_info,
        keyChangeListSetValue(keys, S_state_global_ipv6, dict);
        CFRelease(dict);
 
-       if (val_router != NULL) { /* route add default ... */
+#ifdef RTF_IFSCOPE
+       if (S_scopedroute_v6) {
+           set_ipv6_default_interface(ifn_p);
+       } else
+#endif /* RTF_IFSCOPE */
+       { /* route add default ... */
            struct in6_addr     router;
 
            (void)cfstring_to_ip6(val_router, &router);
@@ -2999,7 +3293,14 @@ update_ipv6(CFDictionaryRef      service_info,
     }
     else {
        keyChangeListRemoveValue(keys, S_state_global_ipv6);
-       set_ipv6_router(NULL, NULL, FALSE);
+#ifdef RTF_IFSCOPE
+       if (S_scopedroute_v6) {
+           set_ipv6_default_interface(NULL);
+       } else
+#endif /* RTF_IFSCOPE */
+       { /* route delete default ... */
+           set_ipv6_router(NULL, NULL, FALSE);
+       }
     }
     return;
 }
@@ -3026,13 +3327,20 @@ update_dns(CFDictionaryRef      service_info,
        keyChangeListRemoveValue(keys, S_state_global_dns);
     }
     else {
+       CFMutableDictionaryRef  new_dict;
+
 #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);
+       new_dict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+       CFDictionaryRemoveValue(new_dict, kSCPropInterfaceName);
+       CFDictionaryRemoveValue(new_dict, kSCPropNetDNSSupplementalMatchDomains);
+       CFDictionaryRemoveValue(new_dict, kSCPropNetDNSSupplementalMatchOrders);
+       keyChangeListSetValue(keys, S_state_global_dns, new_dict);
+       CFRelease(new_dict);
     }
     return;
 }
@@ -3071,9 +3379,11 @@ update_dnsinfo(CFDictionaryRef   service_info,
 static void
 update_proxies(CFDictionaryRef service_info,
               CFStringRef      primary,
-              keyChangeListRef keys)
+              keyChangeListRef keys,
+              CFArrayRef       service_order)
 {
     CFDictionaryRef dict       = NULL;
+    CFDictionaryRef new_dict;
 
     if (primary != NULL) {
        CFDictionaryRef service_dict;
@@ -3081,17 +3391,18 @@ update_proxies(CFDictionaryRef  service_info,
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
            dict = CFDictionaryGetValue(service_dict, kSCEntNetProxies);
-           if (dict == NULL) {
-               dict = my_CFDictionaryGetDictionary(service_info,
-                                                   S_setup_global_proxies);
-           }
        }
     }
-    if (dict == NULL) {
+
+    new_dict = proxy_configuration_update(dict,
+                                         S_service_state_dict,
+                                         service_order);
+    if (new_dict == NULL) {
        keyChangeListRemoveValue(keys, S_state_global_proxies);
     }
     else {
-       keyChangeListSetValue(keys, S_state_global_proxies, dict);
+       keyChangeListSetValue(keys, S_state_global_proxies, new_dict);
+       CFRelease(new_dict);
     }
     return;
 }
@@ -3110,10 +3421,6 @@ update_smb(CFDictionaryRef       service_info,
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
            dict = CFDictionaryGetValue(service_dict, kSCEntNetSMB);
-           if (dict == NULL) {
-               dict = my_CFDictionaryGetDictionary(service_info,
-                                                   S_setup_global_smb);
-           }
        }
     }
     if (dict == NULL) {
@@ -3246,6 +3553,12 @@ elect_ipv4(void * context, election_info_t * info)
        /* never elect as primary */
        return (FALSE);
     }
+    if (strncmp(service_routes->list->ifname, "lo0",
+               sizeof(service_routes->list->ifname)) == 0) {
+       /* never elect as primary */
+       return (FALSE);
+    }
+
     rank_dict_set_service_rank(S_ipv4_service_rank_dict,
                               info->serviceID, info->service_rank);
     return (TRUE);
@@ -3272,6 +3585,11 @@ elect_ipv6(void * context, election_info_t * info)
            return (FALSE);
        }
     }
+    if_name = CFDictionaryGetValue(proto_dict, kSCPropInterfaceName);
+    if (if_name != NULL && CFEqual(if_name, CFSTR("lo0"))) {
+       /* never elect as primary */
+       return (FALSE);
+    }
     router = CFDictionaryGetValue(proto_dict,
                                  kSCPropNetIPv6Router);
     if (router == NULL) {
@@ -3286,9 +3604,7 @@ elect_ipv6(void * context, election_info_t * info)
        info->service_rank = kRankFirst;
     }
     else if (S_ppp_override_primary
-            && CFDictionaryGetValueIfPresent(proto_dict,
-                                             kSCPropInterfaceName,
-                                             (const void **)&if_name)
+            && if_name != NULL
             && CFStringHasPrefix(if_name, CFSTR(PPP_PREFIX))) {
        /* PPP override: make ppp* look the best */
        /* Hack: should use interface type, not interface name */
@@ -3298,6 +3614,7 @@ elect_ipv6(void * context, election_info_t * info)
        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);
@@ -3495,6 +3812,7 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
     keyChangeList      keys;
     CFIndex            n;
     int                        n_service_order = 0;
+    boolean_t          proxies_changed = FALSE;
     CFArrayRef         service_order;
     CFMutableArrayRef  service_changes = NULL;
     CFDictionaryRef    services_info = NULL;
@@ -3518,18 +3836,6 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
            global_ipv4_changed = TRUE;
            global_ipv6_changed = TRUE;
        }
-       else if (CFEqual(change, S_setup_global_proxies)) {
-           if (S_primary_proxies != NULL) {
-               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;
        }
@@ -3573,46 +3879,34 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
     for (i = 0; i < n; i++) {
        uint32_t        changes;
        CFStringRef     serviceID;
-       Boolean         wasSupplemental;
 
        serviceID = CFArrayGetValueAtIndex(service_changes, i);
-       wasSupplemental = dns_has_supplemental(serviceID);
        changes = service_changed(services_info, serviceID);
        if ((changes & (1 << kEntityTypeServiceOptions)) != 0) {
            /* if __Service__ (e.g. PrimaryRank) changed */
            global_ipv4_changed = TRUE;
+           global_ipv6_changed = TRUE;
        }
-       else if (S_primary_ipv4 != NULL && CFEqual(S_primary_ipv4, serviceID)) {
-           // if we are looking at the primary [IPv4] service
+       else {
            if ((changes & (1 << kEntityTypeIPv4)) != 0) {
-               // and something changed for THIS service
                global_ipv4_changed = TRUE;
+               dnsinfo_changed = TRUE;
+               proxies_changed = TRUE;
            }
-       }
-       else if ((changes & (1 << kEntityTypeIPv4)) != 0) {
-           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);
+           if ((changes & (1 << kEntityTypeIPv6)) != 0) {
+               global_ipv6_changed = TRUE;
+               dnsinfo_changed = TRUE;
+               proxies_changed = TRUE;
            }
-           // and something changed for THIS service
-           global_ipv6_changed = TRUE;
        }
        if ((changes & (1 << kEntityTypeDNS)) != 0) {
            if (S_primary_dns != NULL && CFEqual(S_primary_dns, serviceID)) {
                update_dns(services_info, serviceID, &keys);
-               dnsinfo_changed = TRUE;
-           }
-           else if (wasSupplemental || dns_has_supplemental(serviceID)) {
-               dnsinfo_changed = TRUE;
            }
+           dnsinfo_changed = TRUE;
        }
        if ((changes & (1 << kEntityTypeProxies)) != 0) {
-           if (S_primary_proxies != NULL && CFEqual(S_primary_proxies, serviceID)) {
-               update_proxies(services_info, serviceID, &keys);
-           }
+           proxies_changed = TRUE;
        }
 #if    !TARGET_OS_IPHONE
        if ((changes & (1 << kEntityTypeSMB)) != 0) {
@@ -3646,9 +3940,8 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
        }
        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);
-       }
+       (void)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) {
@@ -3711,7 +4004,7 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
            dnsinfo_changed = TRUE;
        }
        if (set_new_primary(&S_primary_proxies, new_primary_proxies, "Proxies")) {
-           update_proxies(services_info, S_primary_proxies, &keys);
+           proxies_changed = TRUE;
        }
 #if    !TARGET_OS_IPHONE
        if (set_new_primary(&S_primary_smb, new_primary_smb, "SMB")) {
@@ -3722,6 +4015,9 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
     if (dnsinfo_changed) {
        update_dnsinfo(services_info, S_primary_dns, &keys, service_order);
     }
+    if (proxies_changed || dnsinfo_changed) {  // note: supplemental Proxies may follow supplemental DNS
+       update_proxies(services_info, S_primary_proxies, &keys, service_order);
+    }
     my_CFRelease(&service_changes);
     my_CFRelease(&services_info);
     keyChangeListApplyToStore(&keys, session);
@@ -3744,6 +4040,10 @@ ip_plugin_init()
     if (S_is_scoped_routing_enabled() != 0) {
        S_scopedroute = TRUE;
     }
+
+    if (S_is_scoped_v6_routing_enabled() != 0) {
+       S_scopedroute_v6 = TRUE;
+    }
 #endif /* RTF_IFSCOPE */
 
     S_session = SCDynamicStoreCreate(NULL, CFSTR("IPMonitor"),
@@ -3780,16 +4080,6 @@ ip_plugin_init()
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
                                                     kSCEntNetIPv4);
-    S_setup_global_proxies
-       = 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,
@@ -3917,6 +4207,7 @@ load_IPMonitor(CFBundleRef bundle, Boolean bundleVerbose)
     }
 
     dns_configuration_init(bundle);
+    proxy_configuration_init(bundle);
     ip_plugin_init();
 
 #if    !TARGET_OS_IPHONE
@@ -4401,12 +4692,12 @@ compare_callback(IPv4RouteListApplyCommand cmd, IPv4RouteRef route, void * arg)
 
     switch (cmd) {
     case kIPv4RouteListAddRouteCommand:
-       printf("Add new[%d] = ", route - context->new->list);
+       printf("Add new[%ld] = ", route - context->new->list);
        IPv4RoutePrint(route);
        printf("\n");
        break;
     case kIPv4RouteListRemoveRouteCommand:
-       printf("Remove old[%d] = ", route - context->old->list);
+       printf("Remove old[%ld] = ", route - context->old->list);
        IPv4RoutePrint(route);
        printf("\n");
        break;
diff --git a/Plugins/IPMonitor/proxy-configuration.c b/Plugins/IPMonitor/proxy-configuration.c
new file mode 100644 (file)
index 0000000..827b99f
--- /dev/null
@@ -0,0 +1,886 @@
+/*
+ * Copyright (c) 2011 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 3, 2011     Allan Nathanson <ajn@apple.com>
+ * - initial revision
+ */
+
+#include <TargetConditionals.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCPrivate.h>
+#include <SystemConfiguration/SCValidation.h>
+
+
+#define DEFAULT_MATCH_ORDER    200000   /* match order for the "default" proxy configuration */
+
+
+#define PROXY_MATCH_ORDER_KEY  CFSTR("__MATCH_ORDER__")
+#define ORDER_KEY              CFSTR("__ORDER__")
+
+
+static CFBooleanRef    S_proxies_follow_dns    = NULL;
+
+
+static void
+add_proxy(CFMutableArrayRef proxies, CFMutableDictionaryRef proxy)
+{
+       CFIndex         i;
+       CFIndex         n_proxies;
+       CFNumberRef     order;
+
+       n_proxies = CFArrayGetCount(proxies);
+       for (i = 0; i < n_proxies; i++) {
+               CFDictionaryRef         match_proxy;
+
+               match_proxy = CFArrayGetValueAtIndex(proxies, i);
+               if (CFEqual(proxy, match_proxy)) {
+                       // a real duplicate
+                       return;
+               }
+       }
+
+       order = CFNumberCreate(NULL, kCFNumberIntType, &n_proxies);
+       CFDictionarySetValue(proxy, ORDER_KEY, order);
+       CFRelease(order);
+
+       CFArrayAppendValue(proxies, proxy);
+       return;
+}
+
+
+static void
+add_supplemental(CFMutableArrayRef proxies, CFDictionaryRef proxy, uint32_t defaultOrder)
+{
+       CFArrayRef      domains;
+       CFIndex         i;
+       CFIndex         n_domains;
+       CFArrayRef      orders;
+
+       domains = CFDictionaryGetValue(proxy, kSCPropNetProxiesSupplementalMatchDomains);
+       n_domains = isA_CFArray(domains) ? CFArrayGetCount(domains) : 0;
+       if (n_domains == 0) {
+               return;
+       }
+
+       orders = CFDictionaryGetValue(proxy, kSCPropNetProxiesSupplementalMatchOrders);
+       if (orders != NULL) {
+               if (!isA_CFArray(orders) || (n_domains != CFArrayGetCount(orders))) {
+                       return;
+               }
+       }
+
+       /*
+        * yes, this is a "supplemental" proxy configuration, expand
+        * the match domains and add each to the proxies list.
+        */
+       for (i = 0; i < n_domains; i++) {
+               CFStringRef             match_domain;
+               CFNumberRef             match_order;
+               CFMutableDictionaryRef  match_proxy;
+
+               match_domain = CFArrayGetValueAtIndex(domains, i);
+               if (!isA_CFString(match_domain)) {
+                       continue;
+               }
+
+               match_proxy = CFDictionaryCreateMutableCopy(NULL, 0, proxy);
+
+               // set supplemental proxy match "domain"
+               match_domain = _SC_trimDomain(match_domain);
+               if (match_domain != NULL) {
+                       CFDictionarySetValue(match_proxy, kSCPropNetProxiesSupplementalMatchDomain, match_domain);
+                       CFRelease(match_domain);
+               } else {
+                       CFDictionaryRemoveValue(match_proxy, kSCPropNetProxiesSupplementalMatchDomain);
+               }
+
+               // set supplemental proxy match "order"
+               match_order = (orders != NULL) ? CFArrayGetValueAtIndex(orders, i) : NULL;
+               if (isA_CFNumber(match_order)) {
+                       CFDictionarySetValue(match_proxy, PROXY_MATCH_ORDER_KEY, match_order);
+               } else {
+                       CFNumberRef     num;
+
+                       num = CFNumberCreate(NULL, kCFNumberIntType, &defaultOrder);
+                       CFDictionarySetValue(match_proxy, PROXY_MATCH_ORDER_KEY, num);
+                       CFRelease(num);
+
+                       defaultOrder++;         // if multiple domains, maintain ordering
+               }
+
+               // remove keys we don't want in a supplemental proxy
+               CFDictionaryRemoveValue(match_proxy, kSCPropNetProxiesSupplementalMatchDomains);
+               CFDictionaryRemoveValue(match_proxy, kSCPropNetProxiesSupplementalMatchOrders);
+               CFDictionaryRemoveValue(match_proxy, kSCPropInterfaceName);
+
+               add_proxy(proxies, match_proxy);
+               CFRelease(match_proxy);
+       }
+
+       return;
+}
+
+
+#define        N_QUICK 32
+
+
+static void
+add_supplemental_proxies(CFMutableArrayRef proxies, CFDictionaryRef services, CFArrayRef service_order)
+{
+       const void *            keys_q[N_QUICK];
+       const void **           keys    = keys_q;
+       CFIndex                 i;
+       CFIndex                 n_order;
+       CFIndex                 n_services;
+       const void *            vals_q[N_QUICK];
+       const void **           vals    = vals_q;
+
+       n_services = isA_CFDictionary(services) ? CFDictionaryGetCount(services) : 0;
+       if (n_services == 0) {
+               return;         // if no services
+       }
+
+       if (n_services > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) {
+               keys = CFAllocatorAllocate(NULL, n_services * sizeof(CFTypeRef), 0);
+               vals = CFAllocatorAllocate(NULL, n_services * sizeof(CFTypeRef), 0);
+       }
+
+       n_order = isA_CFArray(service_order) ? CFArrayGetCount(service_order) : 0;
+
+       CFDictionaryGetKeysAndValues(services, keys, vals);
+       for (i = 0; i < n_services; i++) {
+               uint32_t                defaultOrder;
+               CFDictionaryRef         proxy;
+               CFMutableDictionaryRef  proxyWithDNS    = NULL;
+               CFDictionaryRef         service         = (CFDictionaryRef)vals[i];
+
+               if (!isA_CFDictionary(service)) {
+                       continue;
+               }
+
+               proxy = CFDictionaryGetValue(service, kSCEntNetProxies);
+               if (!isA_CFDictionary(proxy)) {
+                       continue;
+               }
+
+               if ((S_proxies_follow_dns != NULL) && CFBooleanGetValue(S_proxies_follow_dns)) {
+                       CFDictionaryRef dns;
+                       CFArrayRef      matchDomains;
+                       CFArrayRef      matchOrders;
+
+                       if (!CFDictionaryContainsKey(proxy, kSCPropNetProxiesSupplementalMatchDomains) &&
+                           CFDictionaryGetValueIfPresent(service, kSCEntNetDNS, (const void **)&dns) &&
+                           isA_CFDictionary(dns) &&
+                           CFDictionaryGetValueIfPresent(dns, kSCPropNetDNSSupplementalMatchDomains, (const void **)&matchDomains) &&
+                           isA_CFArray(matchDomains)) {
+                               proxyWithDNS = CFDictionaryCreateMutableCopy(NULL, 0, proxy);
+                               CFDictionarySetValue(proxyWithDNS, kSCPropNetProxiesSupplementalMatchDomains, matchDomains);
+                               if (CFDictionaryGetValueIfPresent(dns, kSCPropNetDNSSupplementalMatchOrders, (const void **)&matchOrders) &&
+                                   isA_CFArray(matchOrders)) {
+                                       CFDictionarySetValue(proxyWithDNS, kSCPropNetProxiesSupplementalMatchOrders, matchOrders);
+                               } else {
+                                       CFDictionaryRemoveValue(proxyWithDNS, kSCPropNetProxiesSupplementalMatchOrders);
+                               }
+                               proxy = proxyWithDNS;
+                       }
+               }
+
+               defaultOrder = DEFAULT_MATCH_ORDER
+                              - (DEFAULT_MATCH_ORDER / 2)
+                              + ((DEFAULT_MATCH_ORDER / 1000) * i);
+               if ((n_order > 0) &&
+                   !CFArrayContainsValue(service_order, CFRangeMake(0, n_order), keys[i])) {
+                       // push out services not specified in service order
+                       defaultOrder += (DEFAULT_MATCH_ORDER / 1000) * n_services;
+               }
+
+               add_supplemental(proxies, proxy, defaultOrder);
+               if (proxyWithDNS != NULL) CFRelease(proxyWithDNS);
+       }
+
+       if (keys != keys_q) {
+               CFAllocatorDeallocate(NULL, keys);
+               CFAllocatorDeallocate(NULL, vals);
+       }
+
+       return;
+}
+
+
+static CFComparisonResult
+compareBySearchOrder(const void *val1, const void *val2, void *context)
+{
+       CFDictionaryRef proxy1  = (CFDictionaryRef)val1;
+       CFDictionaryRef proxy2  = (CFDictionaryRef)val2;
+       CFNumberRef     num1;
+       CFNumberRef     num2;
+       uint32_t        order1  = DEFAULT_MATCH_ORDER;
+       uint32_t        order2  = DEFAULT_MATCH_ORDER;
+
+       num1 = CFDictionaryGetValue(proxy1, PROXY_MATCH_ORDER_KEY);
+       if (!isA_CFNumber(num1) ||
+           !CFNumberGetValue(num1, kCFNumberIntType, &order1)) {
+               order1 = DEFAULT_MATCH_ORDER;
+       }
+
+       num2 = CFDictionaryGetValue(proxy2, PROXY_MATCH_ORDER_KEY);
+       if (!isA_CFNumber(num2) ||
+           !CFNumberGetValue(num2, kCFNumberIntType, &order2)) {
+               order2 = DEFAULT_MATCH_ORDER;
+       }
+
+       if (order1 == order2) {
+               // if same match "order", retain original ordering for configurations
+               if (CFDictionaryGetValueIfPresent(proxy1, ORDER_KEY, (const void **)&num1) &&
+                   CFDictionaryGetValueIfPresent(proxy2, ORDER_KEY, (const void **)&num2) &&
+                   isA_CFNumber(num1) &&
+                   isA_CFNumber(num2) &&
+                   CFNumberGetValue(num1, kCFNumberIntType, &order1) &&
+                   CFNumberGetValue(num2, kCFNumberIntType, &order2)) {
+                       if (order1 == order2) {
+                               return kCFCompareEqualTo;
+                       } else {
+                               return (order1 < order2) ? kCFCompareLessThan : kCFCompareGreaterThan;
+                       }
+               }
+
+               return kCFCompareEqualTo;
+       }
+
+       return (order1 < order2) ? kCFCompareLessThan : kCFCompareGreaterThan;
+}
+
+
+static __inline__ Boolean
+isSupplementalProxy(CFDictionaryRef proxy)
+{
+       if ((proxy != NULL) &&
+           CFDictionaryContainsKey(proxy, kSCPropNetProxiesSupplementalMatchDomain)) {
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+
+static CFArrayRef
+copy_supplemental_proxies(CFArrayRef proxies, Boolean skip)
+{
+       CFIndex                 i;
+       CFIndex                 n_proxies;
+       CFMutableArrayRef       supplemental    = NULL;
+
+       // iterate over services
+
+       n_proxies = isA_CFArray(proxies) ? CFArrayGetCount(proxies) : 0;
+       for (i = 0; i < n_proxies; i++) {
+               CFDictionaryRef         proxy;
+
+               proxy = CFArrayGetValueAtIndex(proxies, i);
+               if (!isSupplementalProxy(proxy)) {
+                       // if not supplemental proxy (i.e. no match domain)
+                       continue;
+               }
+
+               // add [supplemental] proxy entry
+               if (supplemental == NULL) {
+                       supplemental = CFArrayCreateMutable(NULL,
+                                                           0,
+                                                           &kCFTypeArrayCallBacks);
+               }
+               CFArrayAppendValue(supplemental, proxy);
+       }
+
+       return supplemental;
+}
+
+
+static CFDictionaryRef
+copy_scoped_proxies(CFDictionaryRef services, CFArrayRef service_order)
+{
+       const void *            keys_q[N_QUICK];
+       const void **           keys    = keys_q;
+       CFIndex                 i;
+       CFIndex                 n_order;
+       CFIndex                 n_services;
+       CFMutableArrayRef       order;
+       CFMutableDictionaryRef  scoped  = NULL;
+
+       n_services = isA_CFDictionary(services) ? CFDictionaryGetCount(services) : 0;
+       if (n_services == 0) {
+               return NULL;            // if no services
+       }
+
+       // ensure that we process all services in order
+
+       n_order = isA_CFArray(service_order) ? CFArrayGetCount(service_order) : 0;
+       if (n_order > 0) {
+               order = CFArrayCreateMutableCopy(NULL, 0, service_order);
+       } else{
+               order = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       }
+
+       if (n_services > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) {
+               keys = CFAllocatorAllocate(NULL, n_services * sizeof(CFTypeRef), 0);
+       }
+       CFDictionaryGetKeysAndValues(services, keys, NULL);
+       for (i = 0; i < n_services; i++) {
+               CFStringRef     serviceID = (CFStringRef)keys[i];
+
+               if (!CFArrayContainsValue(order, CFRangeMake(0, n_order), serviceID)) {
+                       CFArrayAppendValue(order, serviceID);
+                       n_order++;
+               }
+       }
+       if (keys != keys_q) {
+               CFAllocatorDeallocate(NULL, keys);
+       }
+
+       // iterate over services
+
+       for (i = 0; i < n_order; i++) {
+               CFDictionaryRef         proxy;
+               char                    if_name[IF_NAMESIZE];
+               CFStringRef             interface;
+               CFMutableDictionaryRef  newProxy;
+               CFDictionaryRef         service;
+               CFStringRef             serviceID;
+
+               serviceID = CFArrayGetValueAtIndex(order, i);
+               service = CFDictionaryGetValue(services, serviceID);
+               if (!isA_CFDictionary(service)) {
+                       // if no service
+                       continue;
+               }
+
+               proxy = CFDictionaryGetValue(service, kSCEntNetProxies);
+               if (!isA_CFDictionary(proxy)) {
+                       // if no proxy
+                       continue;
+               }
+
+               interface = CFDictionaryGetValue(proxy, kSCPropInterfaceName);
+               if (interface == NULL) {
+                       // if no [scoped] interface
+                       continue;
+               }
+               if ((scoped != NULL) &&
+                   CFDictionaryContainsKey(scoped, interface)) {
+                       // if we've already processed this [scoped] interface
+                       continue;
+               }
+
+               if ((_SC_cfstring_to_cstring(interface,
+                                            if_name,
+                                            sizeof(if_name),
+                                            kCFStringEncodingASCII) == NULL) ||
+                   ((if_nametoindex(if_name)) == 0)) {
+                       // if interface index not available
+                       continue;
+               }
+
+               // add [scoped] proxy entry
+               // ... and remove keys we don't want in a [scoped] proxy
+               CFRetain(interface);
+               newProxy = CFDictionaryCreateMutableCopy(NULL, 0, proxy);
+               CFDictionaryRemoveValue(newProxy, kSCPropNetProxiesSupplementalMatchDomains);
+               CFDictionaryRemoveValue(newProxy, kSCPropNetProxiesSupplementalMatchOrders);
+               CFDictionaryRemoveValue(newProxy, kSCPropInterfaceName);
+               if (scoped == NULL) {
+                       scoped = CFDictionaryCreateMutable(NULL,
+                                                          0,
+                                                          &kCFTypeDictionaryKeyCallBacks,
+                                                          &kCFTypeDictionaryValueCallBacks);
+               }
+               CFDictionarySetValue(scoped, interface, newProxy);
+               CFRelease(newProxy);
+               CFRelease(interface);
+       }
+
+       CFRelease(order);
+       return scoped;
+}
+
+
+static void
+add_default_proxy(CFMutableArrayRef    proxies,
+                 CFDictionaryRef       defaultProxy,
+                 Boolean               *orderAdded)
+{
+       CFMutableDictionaryRef  myDefault;
+       uint32_t                myOrder = DEFAULT_MATCH_ORDER;
+       CFNumberRef             order   = NULL;
+
+       if (defaultProxy == NULL) {
+               myDefault = CFDictionaryCreateMutable(NULL,
+                                                     0,
+                                                     &kCFTypeDictionaryKeyCallBacks,
+                                                     &kCFTypeDictionaryValueCallBacks);
+       } else {
+               myDefault = CFDictionaryCreateMutableCopy(NULL, 0, defaultProxy);
+               CFDictionaryRemoveValue(myDefault, kSCPropInterfaceName);
+               order = CFDictionaryGetValue(myDefault, PROXY_MATCH_ORDER_KEY);
+       }
+
+       // ensure that the default proxy has a search order
+
+       if (!isA_CFNumber(order) ||
+           !CFNumberGetValue(order, kCFNumberIntType, &myOrder)) {
+               myOrder = DEFAULT_MATCH_ORDER;
+               order = CFNumberCreate(NULL, kCFNumberIntType, &myOrder);
+               CFDictionarySetValue(myDefault, PROXY_MATCH_ORDER_KEY, order);
+               CFRelease(order);
+               *orderAdded = TRUE;
+       }
+
+       // add the default proxy
+
+       add_proxy(proxies, myDefault);
+       CFRelease(myDefault);
+       return;
+}
+
+
+static CFComparisonResult
+compareDomain(const void *val1, const void *val2, void *context)
+{
+       CFDictionaryRef         proxy1  = (CFDictionaryRef)val1;
+       CFDictionaryRef         proxy2  = (CFDictionaryRef)val2;
+       CFStringRef             domain1;
+       CFStringRef             domain2;
+       CFArrayRef              labels1 = NULL;
+       CFArrayRef              labels2 = NULL;
+       CFIndex                 n1;
+       CFIndex                 n2;
+       CFComparisonResult      result;
+       Boolean                 rev1;
+       Boolean                 rev2;
+
+       // "default" domains sort before "supplemental" domains
+       domain1 = CFDictionaryGetValue(proxy1, kSCPropNetProxiesSupplementalMatchDomain);
+       domain2 = CFDictionaryGetValue(proxy2, kSCPropNetProxiesSupplementalMatchDomain);
+       if (domain1 == NULL) {
+               if (domain2 == NULL) {
+                       return kCFCompareEqualTo;
+               }
+               return kCFCompareLessThan;
+       } else if (domain2 == NULL) {
+               return kCFCompareGreaterThan;
+       }
+
+       // forward (A, AAAA) domains sort before reverse (PTR) domains
+       rev1 = CFStringHasSuffix(domain1, CFSTR(".arpa"));
+       rev2 = CFStringHasSuffix(domain2, CFSTR(".arpa"));
+       if (rev1 != rev2) {
+               if (rev1) {
+                       return kCFCompareGreaterThan;
+               } else {
+                       return kCFCompareLessThan;
+               }
+       }
+
+       labels1 = CFStringCreateArrayBySeparatingStrings(NULL, domain1, CFSTR("."));
+       n1 = CFArrayGetCount(labels1);
+
+       labels2 = CFStringCreateArrayBySeparatingStrings(NULL, domain2, CFSTR("."));
+       n2 = CFArrayGetCount(labels2);
+
+       while ((n1 > 0) && (n2 > 0)) {
+               CFStringRef     label1  = CFArrayGetValueAtIndex(labels1, --n1);
+               CFStringRef     label2  = CFArrayGetValueAtIndex(labels2, --n2);
+
+               // compare domain labels
+               result = CFStringCompare(label1, label2, kCFCompareCaseInsensitive);
+               if (result != kCFCompareEqualTo) {
+                       goto done;
+               }
+       }
+
+       // longer labels (corp.apple.com) sort before shorter labels (apple.com)
+       if (n1 > n2) {
+               result = kCFCompareLessThan;
+               goto done;
+       } else if (n1 < n2) {
+               result = kCFCompareGreaterThan;
+               goto done;
+       }
+
+       // sort by search order
+       result = compareBySearchOrder(val1, val2, context);
+
+    done :
+
+       if (labels1 != NULL) CFRelease(labels1);
+       if (labels2 != NULL) CFRelease(labels2);
+       return result;
+}
+
+
+__private_extern__
+CFDictionaryRef
+proxy_configuration_update(CFDictionaryRef     defaultProxy,
+                          CFDictionaryRef      services,
+                          CFArrayRef           serviceOrder)
+{
+       CFIndex                 i;
+       CFMutableDictionaryRef  myDefault;
+       Boolean                 myOrderAdded    = FALSE;
+       CFMutableDictionaryRef  newProxy        = NULL;
+       CFIndex                 n_proxies;
+       CFDictionaryRef         proxy;
+       CFMutableArrayRef       proxies;
+
+       SCLog(TRUE, LOG_DEBUG, CFSTR("defaultProxy : %@"), defaultProxy ? defaultProxy : (CFTypeRef)CFSTR("NULL"));
+       SCLog(TRUE, LOG_DEBUG, CFSTR("services : %@"), services ? services : (CFTypeRef)CFSTR("NULL"));
+       SCLog(TRUE, LOG_DEBUG, CFSTR("serviceOrder : %@"), serviceOrder ? serviceOrder : (CFTypeRef)CFSTR("NULL"));
+
+       // establish full list of proxies
+
+       proxies = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       // collect (and add) any "supplemental" proxy configurations
+
+       add_supplemental_proxies(proxies, services, serviceOrder);
+
+       // add the "default" proxy
+
+       add_default_proxy(proxies, defaultProxy, &myOrderAdded);
+
+       // sort proxies, cleanup
+
+       n_proxies = CFArrayGetCount(proxies);
+       if (n_proxies > 1) {
+               CFArraySortValues(proxies, CFRangeMake(0, n_proxies), compareDomain, NULL);
+       }
+
+       // cleanup
+
+       for (i = n_proxies - 1; i >= 0; i--) {
+               proxy = CFArrayGetValueAtIndex(proxies, i);
+
+               if ((i > 0) &&
+                   !CFDictionaryContainsKey(proxy, kSCPropNetProxiesSupplementalMatchDomain)) {
+                       // remove non-supplemental proxy
+                       CFArrayRemoveValueAtIndex(proxies, i);
+                       n_proxies--;
+                       continue;
+               }
+
+               newProxy = CFDictionaryCreateMutableCopy(NULL, 0, proxy);
+               CFDictionaryRemoveValue(newProxy, PROXY_MATCH_ORDER_KEY);
+               CFDictionaryRemoveValue(newProxy, ORDER_KEY);
+               CFArraySetValueAtIndex(proxies, i, newProxy);
+               CFRelease(newProxy);
+       }
+
+       // update the default proxy
+
+       myDefault = CFDictionaryCreateMutableCopy(NULL,
+                                                 0,
+                                                 CFArrayGetValueAtIndex(proxies, 0));
+       if (myOrderAdded && (n_proxies > 1)) {
+               CFDictionaryRef proxy;
+
+               proxy = CFArrayGetValueAtIndex(proxies, 1);
+               if (CFDictionaryContainsKey(proxy, kSCPropNetProxiesSupplementalMatchDomain)) {
+                       // if not a supplemental "default" proxy (a match domain name is
+                       // present)
+                       CFDictionaryRemoveValue(myDefault, PROXY_MATCH_ORDER_KEY);
+               }
+       }
+       CFArraySetValueAtIndex(proxies, 0, myDefault);
+       CFRelease(myDefault);
+
+       // establish proxy configuration
+
+       if (n_proxies > 0) {
+               CFDictionaryRef         scoped;
+               Boolean                 skip    = FALSE;
+               CFArrayRef              supplemental;
+
+               proxy = CFArrayGetValueAtIndex(proxies, 0);
+               if (!CFDictionaryContainsKey(proxy, kSCPropNetProxiesSupplementalMatchDomain)) {
+                       // if we have "a" default (non-supplemental) proxy
+                       newProxy = CFDictionaryCreateMutableCopy(NULL, 0, proxy);
+                       CFDictionaryRemoveValue(newProxy, kSCPropNetProxiesSupplementalMatchDomains);
+                       CFDictionaryRemoveValue(newProxy, kSCPropNetProxiesSupplementalMatchOrders);
+                       skip = TRUE;
+               } else {
+                       newProxy = CFDictionaryCreateMutable(NULL,
+                                                            0,
+                                                            &kCFTypeDictionaryKeyCallBacks,
+                                                            &kCFTypeDictionaryValueCallBacks);
+               }
+
+               // collect (and add) any "supplemental" proxy configurations
+
+               supplemental = copy_supplemental_proxies(proxies, skip);
+               if (supplemental != NULL) {
+                       CFDictionarySetValue(newProxy, kSCPropNetProxiesSupplemental, supplemental);
+                       CFRelease(supplemental);
+               }
+
+               // collect (and add) any "scoped" proxy configurations
+
+               scoped = copy_scoped_proxies(services, serviceOrder);
+               if (scoped != NULL) {
+                       CFDictionarySetValue(newProxy, kSCPropNetProxiesScoped, scoped);
+                       CFRelease(scoped);
+               }
+       } else {
+               newProxy = NULL;
+       }
+
+       CFRelease(proxies);
+       return newProxy;
+}
+
+
+__private_extern__
+void
+proxy_configuration_init(CFBundleRef bundle)
+{
+       CFDictionaryRef dict;
+
+       dict = CFBundleGetInfoDictionary(bundle);
+       if (isA_CFDictionary(dict)) {
+               S_proxies_follow_dns = CFDictionaryGetValue(dict, CFSTR("SupplementalProxiesFollowSupplementalDNS"));
+               S_proxies_follow_dns = isA_CFBoolean(S_proxies_follow_dns);
+       }
+
+       return;
+}
+
+
+#ifdef MAIN
+
+static void
+mergeDict(const void *key, const void *value, void *context)
+{
+       CFMutableDictionaryRef  newDict = (CFMutableDictionaryRef)context;
+
+       CFDictionarySetValue(newDict, key, value);
+       return;
+}
+
+
+static void
+split(const void * key, const void * value, void * context)
+{
+       CFArrayRef              components;
+       CFStringRef             entity_id;
+       CFStringRef             service_id;
+       CFMutableDictionaryRef  state_dict;
+
+       components = CFStringCreateArrayBySeparatingStrings(NULL, (CFStringRef)key, CFSTR("/"));
+       service_id = CFArrayGetValueAtIndex(components, 3);
+       entity_id  = CFArrayGetValueAtIndex(components, 4);
+       state_dict = (CFMutableDictionaryRef)CFDictionaryGetValue(context, service_id);
+       if (state_dict != NULL) {
+               state_dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
+       } else {
+               state_dict = CFDictionaryCreateMutable(NULL,
+                                                      0,
+                                                      &kCFTypeDictionaryKeyCallBacks,
+                                                      &kCFTypeDictionaryValueCallBacks);
+       }
+
+       if (CFEqual(entity_id, kSCEntNetIPv4) ||
+           CFEqual(entity_id, kSCEntNetIPv6)) {
+               CFStringRef     interface;
+
+               interface = CFDictionaryGetValue((CFDictionaryRef)value, kSCPropInterfaceName);
+               if (interface != NULL) {
+                       CFDictionaryRef         proxy;
+                       CFMutableDictionaryRef  new_proxy;
+
+                       proxy = CFDictionaryGetValue(state_dict, kSCEntNetProxies);
+                       if (proxy != NULL) {
+                               new_proxy = CFDictionaryCreateMutableCopy(NULL, 0, proxy);
+                       } else {
+                               new_proxy = CFDictionaryCreateMutable(NULL,
+                                                               0,
+                                                               &kCFTypeDictionaryKeyCallBacks,
+                                                               &kCFTypeDictionaryValueCallBacks);
+                       }
+                       CFDictionarySetValue(new_proxy, kSCPropInterfaceName, interface);
+                       CFDictionarySetValue(state_dict, kSCEntNetProxies, new_proxy);
+                       CFRelease(new_proxy);
+               }
+       } else if (CFEqual(entity_id, kSCEntNetProxies)) {
+               CFDictionaryRef proxy;
+
+               proxy = CFDictionaryGetValue(state_dict, kSCEntNetProxies);
+               if (proxy != NULL) {
+                       CFStringRef             domain;
+                       CFMutableDictionaryRef  new_proxy;
+
+                       // if we already have some Setup: or State: proxy content
+                       domain = CFArrayGetValueAtIndex(components, 0);
+                       if (CFEqual(domain, kSCDynamicStoreDomainState)) {
+                               // if we've already seen the Setup: key
+                               new_proxy = CFDictionaryCreateMutableCopy(NULL, 0, (CFDictionaryRef)value);
+                               CFDictionaryApplyFunction(proxy, mergeDict, new_proxy);
+                       } else {
+                               // if we've already seen the State: key
+                               new_proxy = CFDictionaryCreateMutableCopy(NULL, 0, proxy);
+                               CFDictionaryApplyFunction((CFDictionaryRef)value, mergeDict, new_proxy);
+                       }
+                       CFDictionarySetValue(state_dict, kSCEntNetProxies, new_proxy);
+                       CFRelease(new_proxy);
+               } else {
+                       CFDictionarySetValue(state_dict, kSCEntNetProxies, (CFDictionaryRef)value);
+               }
+       } else {
+               CFDictionarySetValue(state_dict, entity_id, (CFDictionaryRef)value);
+       }
+
+       CFDictionarySetValue((CFMutableDictionaryRef)context, service_id, state_dict);
+       CFRelease(state_dict);
+       CFRelease(components);
+
+       return;
+}
+
+int
+main(int argc, char **argv)
+{
+       CFDictionaryRef         entities;
+       CFStringRef             key;
+       CFDictionaryRef         newProxy        = NULL;
+       CFStringRef             pattern;
+       CFMutableArrayRef       patterns;
+       CFStringRef             primary         = NULL;
+       CFMutableDictionaryRef  primary_proxy   = NULL;
+       CFArrayRef              service_order   = NULL;
+       CFMutableDictionaryRef  service_state_dict;
+       CFDictionaryRef         setup_global_ipv4;
+       CFDictionaryRef         state_global_ipv4;
+       SCDynamicStoreRef       store;
+
+       _sc_log     = FALSE;
+       _sc_verbose = (argc > 1) ? TRUE : FALSE;
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("TEST"), NULL, NULL);
+
+       // get IPv4, IPv6, and Proxies entities
+       patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPv4);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPv6);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainSetup,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetProxies);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetProxies);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       entities = SCDynamicStoreCopyMultiple(store, NULL, patterns);
+       CFRelease(patterns);
+
+       service_state_dict = CFDictionaryCreateMutable(NULL,
+                                                      0,
+                                                      &kCFTypeDictionaryKeyCallBacks,
+                                                      &kCFTypeDictionaryValueCallBacks);
+       CFDictionaryApplyFunction(entities, split, service_state_dict);
+       CFRelease(entities);
+
+       // get primary service ID
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainState,
+                                                        kSCEntNetIPv4);
+       state_global_ipv4 = SCDynamicStoreCopyValue(store, key);
+       CFRelease(key);
+       if (state_global_ipv4 != NULL) {
+               primary = CFDictionaryGetValue(state_global_ipv4, kSCDynamicStorePropNetPrimaryService);
+               if (primary != NULL) {
+                       CFDictionaryRef service_dict;
+
+                       // get proxy configuration for primary service
+                       service_dict = CFDictionaryGetValue(service_state_dict, primary);
+                       if (service_dict != NULL) {
+                               CFDictionaryRef service_proxy;
+
+                               service_proxy = CFDictionaryGetValue(service_dict, kSCEntNetProxies);
+                               if (service_proxy != NULL) {
+                                       primary_proxy = CFDictionaryCreateMutableCopy(NULL, 0, service_proxy);
+                                       CFDictionaryRemoveValue(primary_proxy, kSCPropInterfaceName);
+                               }
+                       }
+               }
+       }
+
+       // get serviceOrder
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainSetup,
+                                                        kSCEntNetIPv4);
+       setup_global_ipv4 = SCDynamicStoreCopyValue(store, key);
+       CFRelease(key);
+       if (setup_global_ipv4 != NULL) {
+               service_order = CFDictionaryGetValue(setup_global_ipv4, kSCPropNetServiceOrder);
+       }
+
+       // update proxy configuration
+       proxy_configuration_init(CFBundleGetMainBundle());
+       newProxy = proxy_configuration_update(primary_proxy,
+                                             service_state_dict,
+                                             service_order);
+       if (newProxy != NULL) {
+               SCPrint(TRUE, stdout, CFSTR("%@\n"), newProxy);
+               CFRelease(newProxy);
+       }
+
+       // cleanup
+       if (setup_global_ipv4 != NULL)  CFRelease(setup_global_ipv4);
+       if (state_global_ipv4 != NULL)  CFRelease(state_global_ipv4);
+       CFRelease(service_state_dict);
+       CFRelease(store);
+
+       /* not reached */
+       exit(0);
+       return 0;
+}
+#endif
+
diff --git a/Plugins/IPMonitor/proxy-configuration.h b/Plugins/IPMonitor/proxy-configuration.h
new file mode 100644 (file)
index 0000000..c03d9e4
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2011 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@
+ */
+
+#ifndef _PROXY_CONFIGURATION_H
+#define _PROXY_CONFIGURATION_H
+
+#include <TargetConditionals.h>
+#include <sys/cdefs.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+__BEGIN_DECLS
+
+void           proxy_configuration_init        (CFBundleRef            bundle);
+
+
+CFDictionaryRef        proxy_configuration_update      (CFDictionaryRef        defaultProxy,
+                                                CFDictionaryRef        services,
+                                                CFArrayRef             serviceOrder);
+
+__END_DECLS
+
+#endif /* _PROXY_CONFIGURATION_H */
+
index 41b0a0c7fbf5fbb8158b1ff99108837a0f7b1a3d..8d8087065d36ba7aa216393bf473876b73b87957 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -441,29 +441,28 @@ getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, voi
        CFMachPortInvalidate(dnsPort);
        CFRelease(dnsPort);
        dnsPort = NULL;
-       __MACH_PORT_DEBUG(mp != NULL, "*** set-hostname (after unscheduling)", mp);
+       __MACH_PORT_DEBUG(mp != MACH_PORT_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);
+       __MACH_PORT_DEBUG(mp != MACH_PORT_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
-               };
+               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);
+               dnsPort = _SC_CFMachPortCreateWithPort("IPMonitor/set-hostname/re-queue",
+                                                      mp,
+                                                      getnameinfo_async_handleCFReply,
+                                                      &context);
                rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
                CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
                CFRelease(rls);
-               __MACH_PORT_DEBUG(mp != NULL, "*** set-hostname (after rescheduling)", mp);
+               __MACH_PORT_DEBUG(mp != MACH_PORT_NULL, "*** set-hostname (after rescheduling)", mp);
        }
 
        return;
@@ -550,11 +549,10 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
                __MACH_PORT_DEBUG(TRUE, "*** set-hostname (after getnameinfo_async_start)", mp);
 
                dnsActive = TRUE;
-               dnsPort = CFMachPortCreateWithPort(NULL,
-                                                  mp,
-                                                  getnameinfo_async_handleCFReply,
-                                                  &context,
-                                                  NULL);
+               dnsPort = _SC_CFMachPortCreateWithPort("IPMonitor/set-hostname",
+                                                      mp,
+                                                      getnameinfo_async_handleCFReply,
+                                                      &context);
                rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
                CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
                CFRelease(rls);
index 795dd43132f4b9ac87c36c8c6ccfffdd191c9a10..3325efcd2888cbb86a3c40955b58048286566381 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -296,7 +296,7 @@ smb_set_configuration(SCDynamicStoreRef store, CFDictionaryRef dict)
                // Server description
                str = SCDynamicStoreCopyComputerName(store, &macEncoding);
                update_pref(prefs, CFSTR(kSMBPrefServerDescription), str, &changed);
-               
+
                // DOS code page
                if (str != NULL) {
                        if (macEncoding == kCFStringEncodingMacRoman) {
@@ -361,10 +361,12 @@ smb_set_configuration(SCDynamicStoreRef store, CFDictionaryRef dict)
        }
        update_pref(prefs, CFSTR(kSMBPrefNetBIOSNodeType), str, &changed);
 
+#ifdef ADD_NETBIOS_SCOPE
        // NetBIOS scope
        str = CFDictionaryGetValue(dict, kSCPropNetSMBNetBIOSScope);
        str = isA_CFString(str);
        update_pref(prefs, CFSTR(kSMBPrefNetBIOSScope), str, &changed);
+#endif // ADD_NETBIOS_SCOPE
 
        // WINS addresses
        array = CFDictionaryGetValue(dict, kSCPropNetSMBWINSAddresses);
@@ -623,15 +625,14 @@ getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, voi
                                                  , CFRetain
                                                  , CFRelease
                                                  , replyMPCopyDescription
-               };
+                                                 };
                CFRunLoopSourceRef      rls;
 
                // if request has been re-queued
-               dnsPort = CFMachPortCreateWithPort(NULL,
-                                                  mp,
-                                                  getnameinfo_async_handleCFReply,
-                                                  &context,
-                                                  NULL);
+               dnsPort = _SC_CFMachPortCreateWithPort("IPMonitor/smb-configuration/re-queue",
+                                                      mp,
+                                                      getnameinfo_async_handleCFReply,
+                                                      &context);
                rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
                CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
                CFRelease(rls);
@@ -720,11 +721,10 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
                }
 
                dnsActive = TRUE;
-               dnsPort = CFMachPortCreateWithPort(NULL,
-                                                  mp,
-                                                  getnameinfo_async_handleCFReply,
-                                                  &context,
-                                                  NULL);
+               dnsPort = _SC_CFMachPortCreateWithPort("IPMonitor/smb-configuration",
+                                                      mp,
+                                                      getnameinfo_async_handleCFReply,
+                                                      &context);
                rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
                CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
                CFRelease(rls);
index cbc99f0d2a42c6ca1720bc45b0911054ca3f5c65..2dbc4b432069c00d2c51419029a7ad148c0edf87 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
 </dict>
 </plist>
diff --git a/Plugins/InterfaceNamer/Makefile b/Plugins/InterfaceNamer/Makefile
new file mode 100644 (file)
index 0000000..705d8af
--- /dev/null
@@ -0,0 +1,13 @@
+
+ifnamer: ifnamer.c
+       cc -Wall -g -DMAIN               -o ifnamer  ifnamer.c -framework CoreFoundation -framework SystemConfiguration -framework IOKit
+
+snapshot: ifnamer.c
+       cc -Wall -g -DTEST_SNAPSHOT      -o snapshot ifnamer.c -framework CoreFoundation -framework SystemConfiguration -framework IOKit
+
+uuid: ifnamer.c
+       cc -Wall -g -DTEST_PLATFORM_UUID -o uuid     ifnamer.c -framework CoreFoundation -framework SystemConfiguration -framework IOKit
+
+clean:
+       rm -rf ifnamer ifnamer.dSYM snapshot snapshot.dSYM uuid uuid.dSYM
+
index f28450a8af8bedf339c7e1728d865035b0b583cf..a0d377b7fa9c200b8835d3b4f1eaf2dde254aa7d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2001-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -62,6 +62,7 @@
 #include <sys/socket.h>
 #include <sys/sockio.h>
 #include <sys/stat.h>
+#include <sys/sysctl.h>
 #include <sys/param.h>
 #include <mach/mach.h>
 #include <net/ethernet.h>
 #include <IOKit/network/IONetworkInterface.h>
 #include <IOKit/usb/USB.h>
 
-#define kIONetworkStackUserCommand     "IONetworkStackUserCommand"
-#define kRegisterInterface             1
+// from <IOKit/network/IONetworkStack.h>
+#define kIONetworkStackUserCommand      "IONetworkStackUserCommand"
+enum {
+    kRegisterInterfaceWithFixedUnit = 0,
+    kRegisterInterface,
+    kRegisterAllInterfaces
+};
 
 #define        kSCNetworkInterfaceInfo         "SCNetworkInterfaceInfo"
 #define        kSCNetworkInterfaceType         "SCNetworkInterfaceType"
@@ -93,6 +99,9 @@
 #define MY_PLUGIN_NAME                 "InterfaceNamer"
 #define        MY_PLUGIN_ID                    CFSTR("com.apple.SystemConfiguration." MY_PLUGIN_NAME)
 
+#define WAIT_STACK_TIMEOUT_KEY         "WaitStackTimeout"
+#define WAIT_STACK_TIMEOUT_DEFAULT     300.0
+
 #define WAIT_QUIET_TIMEOUT_KEY         "WaitQuietTimeout"
 #define WAIT_QUIET_TIMEOUT_DEFAULT     60.0
 
@@ -129,6 +138,12 @@ static CFMutableArrayRef   S_iflist                = NULL;
  */
 static io_iterator_t           S_iter                  = MACH_PORT_NULL;
 
+/*
+ * S_model
+ *   Hardware model for this network configuration.
+ */
+static CFStringRef             S_model                 = NULL;
+
 /*
  * S_notify
  *   notification object for receiving IOKit notifications of
@@ -169,20 +184,30 @@ static CFMutableDictionaryRef     S_state                 = NULL;
  * S_timer
  *   CFRunLoopTimer tracking how long we are willing to wait
  *   for IOKit matching to quiesce (IOKitWaitQuiet).
+ *
+ * S_stack_timeout
+ *   time to wait for the IONetworkStack object to appear before timeout
+ *
+ * S_quiet_timeout
+ *   time to wait for the IOKit to quiesce (after the IONetworkStack is
+ *   has appeared.
  */
 static CFRunLoopTimerRef       S_timer                 = NULL;
+static double                  S_stack_timeout         = WAIT_STACK_TIMEOUT_DEFAULT;
+static double                  S_quiet_timeout         = WAIT_QUIET_TIMEOUT_DEFAULT;
+
 
-#if    !TARGET_OS_IPHONE
 /*
  * Virtual network interface configuration
- *   S_prefs : SCPreferences to configuration
- *   S_bonds : most recently actived Bond configuration
- *   S_vlans : most recently actived VLAN configuration
+ *   S_prefs   : SCPreferences to configuration
+ *   S_bonds   : most recently actived Bond configuration
+ *   S_bridges : most recently actived Bridge configuration
+ *   S_vlans   : most recently actived VLAN configuration
  */
 static SCPreferencesRef                S_prefs                 = NULL;
 static CFArrayRef              S_bonds                 = NULL;
+static CFArrayRef              S_bridges               = NULL;
 static CFArrayRef              S_vlans                 = NULL;
-#endif /* !TARGET_OS_IPHONE */
 
 static void
 addTimestamp(CFMutableDictionaryRef dict, CFStringRef key)
@@ -197,6 +222,35 @@ addTimestamp(CFMutableDictionaryRef dict, CFStringRef key)
     return;
 }
 
+#define        INTERFACES                      CFSTR("Interfaces")
+#define        MODEL                           CFSTR("Model")
+#define        NETWORK_INTERFACES_PREFS        CFSTR("NetworkInterfaces.plist")
+
+static CFStringRef
+hw_model()
+{
+    if (S_model == NULL) {
+       char    hwModel[64];
+       int     mib[]           = { CTL_HW, HW_MODEL };
+       size_t  n               = sizeof(hwModel);
+       int     ret;
+
+       // 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;
+       }
+       hwModel[sizeof(hwModel) - 1] = '\0';
+
+       S_model = CFStringCreateWithCString(NULL, hwModel, kCFStringEncodingASCII);
+    }
+
+    return S_model;
+
+}
+
 static CFComparisonResult
 if_unit_compare(const void *val1, const void *val2, void *context)
 {
@@ -221,90 +275,27 @@ if_unit_compare(const void *val1, const void *val2, void *context)
     return (CFNumberCompare(unit1, unit2, NULL));
 }
 
-static void *
-read_file(char * filename, size_t * data_length)
+static void
+reportIssue(const char *signature, CFStringRef issue)
 {
-    void *             data    = NULL;
-    size_t             len     = 0;
-    int                        fd      = -1;
-    struct stat                sb;
+    aslmsg  m;
 
-    *data_length = 0;
-    if (stat(filename, &sb) == -1)
-       goto done;
-    len = sb.st_size;
-    if (len == 0)
-       goto done;
-
-    data = malloc(len);
-    if (data == NULL)
-       goto done;
+    m = asl_new(ASL_TYPE_MSG);
+    asl_set(m, "com.apple.message.domain", "com.apple.SystemConfiguration." MY_PLUGIN_NAME);
+    asl_set(m, "com.apple.message.signature", signature);
+    asl_set(m, "com.apple.message.result", "failure");
+    SCLOG(NULL, m, ~ASL_LEVEL_ERR, CFSTR("%s\n%@"), signature, issue);
+    asl_free(m);
 
-    fd = open(filename, O_RDONLY);
-    if (fd == -1)
-       goto done;
-
-    if (read(fd, data, len) != len) {
-       SCLog(TRUE, LOG_ERR,
-             CFSTR(MY_PLUGIN_NAME ": read %s failed, %s"),
-             filename, strerror(errno));
-       goto done;
-    }
-
- done:
-    if (fd != -1)
-       close(fd);
-    if (data) {
-       *data_length = len;
-    }
-    return (data);
-}
-
-static CFPropertyListRef
-readPropertyList(char * filename)
-{
-    void *             buf;
-    size_t             bufsize;
-    CFDataRef          data            = NULL;
-    CFPropertyListRef  plist           = NULL;
-    CFStringRef                errorString     = NULL;
-
-    buf = read_file(filename, &bufsize);
-    if (buf == NULL) {
-       return (NULL);
-    }
-    data = CFDataCreate(NULL, buf, bufsize);
-    if (data == NULL) {
-       goto error;
-    }
-
-    plist = CFPropertyListCreateFromXMLData(NULL, data,
-                                           kCFPropertyListMutableContainers,
-                                           &errorString);
-    if (plist == NULL) {
-       if (errorString != NULL) {
-           SCLog(TRUE, LOG_ERR,
-                 CFSTR(MY_PLUGIN_NAME ": %@"),
-                 errorString);
-           CFRelease(errorString);
-       }
-    }
- error:
-    if (data)
-       CFRelease(data);
-    if (buf)
-       free(buf);
-    return (plist);
+    return;
 }
 
-#define        INTERFACES                      CFSTR("Interfaces")
-#define        NETWORK_INTERFACES_PREFS        CFSTR("NetworkInterfaces.plist")
-#define        OLD_NETWORK_INTERFACES_FILE     "/var/db/NetworkInterfaces.xml"
-
 static void
 writeInterfaceList(CFArrayRef if_list)
 {
     CFArrayRef         cur_list;
+    CFStringRef                new_model;
+    CFStringRef                old_model;
     SCPreferencesRef   prefs;
 
     if (isA_CFArray(if_list) == NULL) {
@@ -324,6 +315,46 @@ writeInterfaceList(CFArrayRef if_list)
        goto done;
     }
 
+    old_model = SCPreferencesGetValue(prefs, MODEL);
+    new_model = hw_model();
+    if ((old_model != NULL) &&
+       (new_model != NULL) &&
+       !CFEqual(old_model, new_model) &&
+       (cur_list != NULL)) {
+       CFStringRef history;
+       CFStringRef issue;
+
+       // if interface list was created on other hardware
+       history = CFStringCreateWithFormat(NULL, NULL,
+                                          CFSTR("%@:%@"),
+                                          INTERFACES,
+                                          old_model);
+       SCPreferencesSetValue(prefs, history, cur_list);
+       CFRelease(history);
+
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": Hardware model changed\n"
+                   MY_PLUGIN_NAME ":   created on \"%@\"\n"
+                   MY_PLUGIN_NAME ":   now on     \"%@\""),
+             old_model,
+             new_model);
+
+       issue = CFStringCreateWithFormat(NULL, NULL,
+                                        CFSTR("%@ --> %@"),
+                                        old_model,
+                                        new_model);
+       reportIssue("Hardware model changed", issue);
+       CFRelease(issue);
+    }
+
+    if ((new_model != NULL) &&
+       !SCPreferencesSetValue(prefs, MODEL, new_model)) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": SCPreferencesSetValue failed, %s"),
+             SCErrorString(SCError()));
+       goto done;
+    }
+
     if (!SCPreferencesSetValue(prefs, INTERFACES, if_list)) {
        SCLog(TRUE, LOG_ERR,
              CFSTR(MY_PLUGIN_NAME ": SCPreferencesSetValue failed, %s"),
@@ -348,8 +379,9 @@ static CFMutableArrayRef
 readInterfaceList()
 {
     CFArrayRef         if_list;
-    CFMutableArrayRef  plist = NULL;
-    SCPreferencesRef   prefs = NULL;
+    CFStringRef                old_model;
+    CFMutableArrayRef  plist   = NULL;
+    SCPreferencesRef   prefs   = NULL;
 
     prefs = SCPreferencesCreate(NULL, MY_PLUGIN_ID, NETWORK_INTERFACES_PREFS);
     if (!prefs) {
@@ -360,21 +392,19 @@ readInterfaceList()
     }
 
     if_list = SCPreferencesGetValue(prefs, INTERFACES);
-    if (!isA_CFArray(if_list)) {
-       if_list = (CFArrayRef)readPropertyList(OLD_NETWORK_INTERFACES_FILE);
-       if (if_list == NULL) {
-           goto done;
-       }
-       if (!isA_CFArray(if_list)) {
-           CFRelease(if_list);
+    if_list = isA_CFArray(if_list);
+
+    old_model = SCPreferencesGetValue(prefs, MODEL);
+    if (old_model != NULL) {
+       CFStringRef new_model;
+
+       new_model = hw_model();
+       if (!_SC_CFEqual(old_model, new_model)) {
+           // if interface list was created on other hardware
            if_list = NULL;
-           goto done;
        }
-       writeInterfaceList(if_list);
-       (void)unlink(OLD_NETWORK_INTERFACES_FILE);
     }
 
-  done:
     if (if_list != NULL) {
        CFIndex i;
        CFIndex n       = CFArrayGetCount(if_list);
@@ -392,7 +422,8 @@ readInterfaceList()
            }
        }
     }
-    if (prefs) {
+
+    if (prefs != NULL) {
        CFRelease(prefs);
     }
     return (plist);
@@ -450,66 +481,81 @@ updateStore(void)
     return;
 }
 
-#if    !TARGET_OS_IPHONE
 static void
-updateVirtualNetworkInterfaceConfiguration(SCPreferencesRef            prefs,
-                                          SCPreferencesNotification   notificationType,
-                                          void                         *info)
+updateBondInterfaceConfiguration(SCPreferencesRef prefs)
 {
     CFArrayRef interfaces;
 
-    if ((notificationType & kSCPreferencesNotificationApply) != kSCPreferencesNotificationApply) {
+    interfaces = SCBondInterfaceCopyAll(prefs);
+    if ((interfaces != NULL) && (CFArrayGetCount(interfaces) == 0)) {
+       CFRelease(interfaces);
+       interfaces = NULL;
+    }
+
+    if (_SC_CFEqual(S_bonds, interfaces)) {
+       // if no change
+       if (interfaces != NULL) CFRelease(interfaces);
        return;
     }
 
-    if (prefs == NULL) {
-       // if a new interface has been "named"
-       prefs = S_prefs;
-       if (S_bonds != NULL) {
-           CFRelease(S_bonds);
-           S_bonds = NULL;
-       }
-       if (S_vlans != NULL) {
-           CFRelease(S_vlans);
-           S_vlans = NULL;
-       }
+    if (S_bonds != NULL) CFRelease(S_bonds);
+    S_bonds = interfaces;
+
+    if (!_SCBondInterfaceUpdateConfiguration(prefs)) {
+       SCLog(TRUE, LOG_ERR,
+             CFSTR(MY_PLUGIN_NAME ": _SCBondInterfaceUpdateConfiguration failed, %s"),
+             SCErrorString(SCError()));
     }
 
-    // update Bond configuration
+    return;
+}
 
-    interfaces = SCBondInterfaceCopyAll(prefs);
-    if ((S_bonds == NULL) && (interfaces == NULL)) {
-       // if no change
-       goto vlan;
+static void
+updateBridgeInterfaceConfiguration(SCPreferencesRef prefs)
+{
+    CFArrayRef interfaces;
+
+    interfaces = SCBridgeInterfaceCopyAll(prefs);
+    if ((interfaces != NULL) && (CFArrayGetCount(interfaces) == 0)) {
+       CFRelease(interfaces);
+       interfaces = NULL;
     }
-    if ((S_bonds != NULL) && (interfaces != NULL) && CFEqual(S_bonds, interfaces)) {
+
+    if (_SC_CFEqual(S_bridges, interfaces)) {
        // if no change
-       CFRelease(interfaces);
-       goto vlan;
+       if (interfaces != NULL) CFRelease(interfaces);
+       return;
     }
-    if (S_bonds != NULL) CFRelease(S_bonds);
-    S_bonds = interfaces;
 
-    if (!_SCBondInterfaceUpdateConfiguration(prefs)) {
+    if (S_bridges != NULL) CFRelease(S_bridges);
+    S_bridges = interfaces;
+
+    if (!_SCBridgeInterfaceUpdateConfiguration(prefs)) {
        SCLog(TRUE, LOG_ERR,
-             CFSTR(MY_PLUGIN_NAME ": _SCBondInterfaceUpdateConfiguration failed, %s"),
+             CFSTR(MY_PLUGIN_NAME ": _SCBridgeInterfaceUpdateConfiguration failed, %s"),
              SCErrorString(SCError()));
     }
 
-  vlan :
+    return;
+}
 
-    // update VLAN configuration
+static void
+updateVLANInterfaceConfiguration(SCPreferencesRef prefs)
+{
+    CFArrayRef interfaces;
 
     interfaces = SCVLANInterfaceCopyAll(prefs);
-    if ((S_vlans == NULL) && (interfaces == NULL)) {
-       // if no change
-       goto done;
+    if ((interfaces != NULL) && (CFArrayGetCount(interfaces) == 0)) {
+       CFRelease(interfaces);
+       interfaces = NULL;
     }
-    if ((S_vlans != NULL) && (interfaces != NULL) && CFEqual(S_vlans, interfaces)) {
+
+    if (_SC_CFEqual(S_vlans, interfaces)) {
        // if no change
-       CFRelease(interfaces);
-       goto done;
+       if (interfaces != NULL) CFRelease(interfaces);
+       return;
     }
+
     if (S_vlans != NULL) CFRelease(S_vlans);
     S_vlans = interfaces;
 
@@ -519,14 +565,43 @@ updateVirtualNetworkInterfaceConfiguration(SCPreferencesRef               prefs,
              SCErrorString(SCError()));
     }
 
-  done :
+    return;
+}
 
-    // we are finished with current prefs, wait for changes
+static void
+updateVirtualNetworkInterfaceConfiguration(SCPreferencesRef            prefs,
+                                          SCPreferencesNotification   notificationType,
+                                          void                         *info)
+{
+    if ((notificationType & kSCPreferencesNotificationApply) != kSCPreferencesNotificationApply) {
+       return;
+    }
 
+    if (prefs == NULL) {
+       // if a new interface has been "named"
+       prefs = S_prefs;
+       if (S_bonds != NULL) {
+           CFRelease(S_bonds);
+           S_bonds = NULL;
+       }
+       if (S_bridges != NULL) {
+           CFRelease(S_bridges);
+           S_bridges = NULL;
+       }
+       if (S_vlans != NULL) {
+           CFRelease(S_vlans);
+           S_vlans = NULL;
+       }
+    }
+
+    updateBondInterfaceConfiguration  (prefs);
+    updateBridgeInterfaceConfiguration(prefs);
+    updateVLANInterfaceConfiguration  (prefs);
+
+    // we are finished with current prefs, wait for changes
     SCPreferencesSynchronize(prefs);
     return;
 }
-#endif /* !TARGET_OS_IPHONE */
 
 static CFDictionaryRef
 createInterfaceDict(SCNetworkInterfaceRef interface)
@@ -958,21 +1033,36 @@ insertInterface(CFMutableArrayRef db_list, SCNetworkInterfaceRef interface)
 static void
 replaceInterface(SCNetworkInterfaceRef interface)
 {
-    CFIndex where;
+    int                n       = 0;
+    CFIndex    where;
 
     if (S_dblist == NULL) {
        S_dblist = CFArrayCreateMutable(NULL, 0,
                                        &kCFTypeArrayCallBacks);
     }
     // remove any dict that has our type/addr
-    if (lookupInterfaceByAddress(S_dblist, interface, &where) != NULL) {
+    while (lookupInterfaceByAddress(S_dblist, interface, &where) != NULL) {
        CFArrayRemoveValueAtIndex(S_dblist, where);
+       n++;
     }
     // remove any dict that has the same type/unit
-    if (lookupInterfaceByUnit(S_dblist, interface, &where) != NULL) {
+    while (lookupInterfaceByUnit(S_dblist, interface, &where) != NULL) {
        CFArrayRemoveValueAtIndex(S_dblist, where);
+       n++;
     }
     insertInterface(S_dblist, interface);
+
+    if (n > 1) {
+       CFStringRef     issue;
+
+       issue = CFStringCreateWithFormat(NULL, NULL,
+                                        CFSTR("n = %d, %@"),
+                                        n,
+                                        interface);
+       reportIssue("Multiple interfaces updated", issue);
+       CFRelease(issue);
+    }
+
     return;
 }
 
@@ -1017,9 +1107,9 @@ getHighestUnitForType(CFNumberRef if_type)
 static kern_return_t
 registerInterface(io_connect_t connect,
                  CFStringRef   path,
-                 CFNumberRef   unit)
+                 CFNumberRef   unit,
+                 const int     command)
 {
-    static const int           command = kRegisterInterface;
     CFMutableDictionaryRef     dict;
     kern_return_t              kr;
     CFNumberRef                        num;
@@ -1049,7 +1139,7 @@ lookupIOKitPath(CFStringRef if_path)
     kr = IOMasterPort(bootstrap_port, &masterPort);
     if (kr != KERN_SUCCESS) {
        SCLog(TRUE, LOG_ERR,
-             CFSTR(MY_PLUGIN_NAME ": IOMasterPort returned 0x%x\n"),
+             CFSTR(MY_PLUGIN_NAME ": IOMasterPort returned 0x%x"),
              kr);
        goto error;
     }
@@ -1136,6 +1226,7 @@ nameInterfaces(CFMutableArrayRef if_list)
 
     for (i = 0; i < n; i++) {
        SCNetworkInterfaceRef   interface;
+       Boolean                 ok      = TRUE;
        CFStringRef             path;
        CFNumberRef             type;
        CFNumberRef             unit;
@@ -1240,18 +1331,40 @@ nameInterfaces(CFMutableArrayRef if_list)
                      is_builtin ? "built-in" : "next available");
            }
 
-           kr = registerInterface(S_connect, path, unit);
+           kr = registerInterface(S_connect,
+                                  path,
+                                  unit,
+                                  (dbdict == NULL) ? kRegisterInterface : kRegisterInterfaceWithFixedUnit);
            if (kr != KERN_SUCCESS) {
+               CFStringRef issue;
+               const char  *signature;
+
+               signature = (dbdict == NULL) ? "failed to name new interface"
+                                            : "failed to name known interface";
+
                SCLog(TRUE, LOG_ERR,
-                     CFSTR(MY_PLUGIN_NAME ": failed to name the interface, kr=0x%x\n"
+                     CFSTR(MY_PLUGIN_NAME ": %s, kr=0x%x\n"
                            MY_PLUGIN_NAME ":   path = %@\n"
                            MY_PLUGIN_NAME ":   unit = %@"),
+                     signature,
                      kr,
                      path,
                      unit);
+
                if (S_debug) {
                    displayInterface(interface);
                }
+
+               // report issue w/MessageTracer
+               issue = CFStringCreateWithFormat(NULL, NULL,
+                                                CFSTR("kr=0x%x, path=%@, unit=%@"),
+                                                kr,
+                                                path,
+                                                unit);
+               reportIssue(signature, issue);
+               CFRelease(issue);
+
+               ok = FALSE;     // ... and don't update the database
            } else {
                SCNetworkInterfaceRef   new_interface;
 
@@ -1293,7 +1406,9 @@ nameInterfaces(CFMutableArrayRef if_list)
        }
 
        // update db
-       replaceInterface(interface);
+       if (ok) {
+           replaceInterface(interface);
+       }
     }
     return;
 }
@@ -1326,9 +1441,7 @@ 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) {
@@ -1585,6 +1698,14 @@ stackCallback(void *refcon, io_iterator_t iter)
        S_stack = MACH_PORT_NULL;
     }
 
+    if ((S_timer != NULL) && CFRunLoopTimerIsValid(S_timer)) {
+       // With the IONetworkStack object now available we can
+       // reset (shorten?) the time we are willing to wait for
+       // IOKit to quiesce.
+       CFRunLoopTimerSetNextFireDate(S_timer,
+                                     CFAbsoluteTimeGetCurrent() + S_quiet_timeout);
+    }
+
     updateInterfaces();
 
  error:
@@ -1638,17 +1759,19 @@ quietCallback(void              *refcon,
 }
 
 static void
-iterateRegistryBusy(io_iterator_t iterator, CFArrayRef nodes, int *count)
+iterateRegistryBusy(io_iterator_t iterator, CFArrayRef nodes, CFMutableStringRef snapshot, int *count)
 {
     kern_return_t      kr  = kIOReturnSuccess;;
     io_object_t                obj;
 
     while ((kr == kIOReturnSuccess) &&
           ((obj = IOIteratorNext(iterator)) != MACH_PORT_NULL)) {
-       uint32_t                busy;
+       uint64_t                accumulated_busy_time;
+       uint32_t                busy_state;
        io_name_t               location;
        io_name_t               name;
        CFMutableArrayRef       newNodes;
+       uint64_t                state;
        CFMutableStringRef      str     = NULL;
 
        if (nodes == NULL) {
@@ -1660,7 +1783,7 @@ iterateRegistryBusy(io_iterator_t iterator, CFArrayRef nodes, int *count)
        kr = IORegistryEntryGetName(obj, name);
        if (kr != kIOReturnSuccess) {
            SCLog(TRUE, LOG_ERR,
-                 CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryEntryGetName returned 0x%x"),
+                 CFSTR(MY_PLUGIN_NAME ": captureBusy IORegistryEntryGetName returned 0x%x"),
                  kr);
            goto next;
        }
@@ -1678,7 +1801,7 @@ iterateRegistryBusy(io_iterator_t iterator, CFArrayRef nodes, int *count)
                break;
            default :
                SCLog(TRUE, LOG_ERR,
-                     CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryEntryGetLocationInPlane returned 0x%x"),
+                     CFSTR(MY_PLUGIN_NAME ": captureBusy IORegistryEntryGetLocationInPlane returned 0x%x"),
                      kr);
                CFRelease(str);
                goto next;
@@ -1687,40 +1810,51 @@ iterateRegistryBusy(io_iterator_t iterator, CFArrayRef nodes, int *count)
        CFArrayAppendValue(newNodes, str);
        CFRelease(str);
 
-       kr = IOServiceGetBusyState(obj, &busy);
+       kr = IOServiceGetBusyStateAndTime(obj, &state, &busy_state, &accumulated_busy_time);
        if (kr != kIOReturnSuccess) {
            SCLog(TRUE, LOG_ERR,
-                 CFSTR(MY_PLUGIN_NAME ": reportBusy IOServiceGetBusyState returned 0x%x"),
+                 CFSTR(MY_PLUGIN_NAME ": captureBusy IOServiceGetBusyStateAndTime returned 0x%x"),
                  kr);
            goto next;
        }
 
-       if (busy != 0) {
+#ifdef TEST_SNAPSHOT
+       // report all nodes
+       busy_state = 1;
+#endif // TEST_SNAPSHOT
+
+       if (busy_state != 0) {
            CFStringRef path;
 
            if ((*count)++ == 0) {
-               SCLog(TRUE, LOG_WARNING, CFSTR(MY_PLUGIN_NAME ": Busy services :"));
+               CFStringAppend(snapshot, CFSTR("Busy services :"));
            }
 
            path = CFStringCreateByCombiningStrings(NULL, newNodes, CFSTR("/"));
-           SCLog(TRUE, LOG_WARNING, CFSTR(MY_PLUGIN_NAME ":   %@ [%d]"), path, busy);
+           CFStringAppendFormat(snapshot, NULL,
+                                CFSTR("\n  %@ [%s%s%s%d, %lld ms]"),
+                                path,
+                                (state & kIOServiceRegisteredState) ? "" : "!registered, ",
+                                (state & kIOServiceMatchedState)    ? "" : "!matched, ",
+                                (state & kIOServiceInactiveState)   ? "inactive, " : "",
+                                accumulated_busy_time / kMillisecondScale);
            CFRelease(path);
        }
 
        kr = IORegistryIteratorEnterEntry(iterator);
        if (kr != kIOReturnSuccess) {
            SCLog(TRUE, LOG_ERR,
-                 CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryIteratorEnterEntry returned 0x%x"),
+                 CFSTR(MY_PLUGIN_NAME ": captureBusy IORegistryIteratorEnterEntry returned 0x%x"),
                  kr);
            goto next;
        }
 
-       iterateRegistryBusy(iterator, newNodes, count);
+       iterateRegistryBusy(iterator, newNodes, snapshot, count);
 
        kr = IORegistryIteratorExitEntry(iterator);
        if (kr != kIOReturnSuccess) {
            SCLog(TRUE, LOG_ERR,
-                 CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryIteratorExitEntry returned 0x%x"),
+                 CFSTR(MY_PLUGIN_NAME ": captureBusy IORegistryIteratorExitEntry returned 0x%x"),
                  kr);
        }
 
@@ -1733,12 +1867,15 @@ iterateRegistryBusy(io_iterator_t iterator, CFArrayRef nodes, int *count)
     return;
 }
 
-static void
-reportBusy()
+static CFStringRef
+captureBusy()
 {
     int                        count           = 0;
     io_iterator_t      iterator        = MACH_PORT_NULL;
     kern_return_t      kr;
+    CFMutableStringRef snapshot;
+
+    snapshot = CFStringCreateMutable(NULL, 0);
 
     kr = IORegistryCreateIterator(kIOMasterPortDefault,
                                  kIOServicePlane,
@@ -1746,30 +1883,37 @@ reportBusy()
                                  &iterator);
     if (kr != kIOReturnSuccess) {
        SCLog(TRUE, LOG_ERR,
-             CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryCreateIterator returned 0x%x"),
+             CFSTR(MY_PLUGIN_NAME ": captureBusy IORegistryCreateIterator returned 0x%x"),
              kr);
-       return;
+       return snapshot;
+    }
+
+    iterateRegistryBusy(iterator, NULL, snapshot, &count);
+    if (count == 0) {
+       CFStringAppend(snapshot, CFSTR("w/no busy services"));
     }
 
-    iterateRegistryBusy(iterator, NULL, &count);
-    SCLog((count == 0), LOG_WARNING,
-         CFSTR(MY_PLUGIN_NAME ":   w/no busy services"));
     IOObjectRelease(iterator);
-    return;
+    return snapshot;
 }
 
 static void
 timerCallback(CFRunLoopTimerRef        timer, void *info)
 {
-    /*
-     * We've been waiting for IOKit to quiesce and it just
-     * hasn't happenned.  Time to just move on!
-     */
+    CFStringRef        snapshot;
+
+    // We've been waiting for IOKit to quiesce and it just
+    // hasn't happenned.  Time to just move on!
     addTimestamp(S_state, CFSTR("*TIMEOUT*"));
+
+    // log busy nodes
+    snapshot = captureBusy();
     SCLog(TRUE, LOG_ERR,
-         CFSTR(MY_PLUGIN_NAME ": timed out waiting for IOKit to quiesce"));
+         CFSTR(MY_PLUGIN_NAME ": timed out waiting for IOKit to quiesce\n%@"),
+         snapshot);
+    reportIssue("timed out waiting for IOKit to quiesce", snapshot);
+    CFRelease(snapshot);
 
-    reportBusy();
     quietCallback((void *)S_notify, MACH_PORT_NULL, 0, NULL);
     return;
 }
@@ -1778,12 +1922,10 @@ static Boolean
 setup_IOKit(CFBundleRef bundle)
 {
     uint32_t           busy;
-    CFDictionaryRef    dict;
     kern_return_t      kr;
     mach_port_t                masterPort      = MACH_PORT_NULL;
     Boolean            ok              = FALSE;
     io_object_t                root            = MACH_PORT_NULL;
-    double             timeout         = WAIT_QUIET_TIMEOUT_DEFAULT;
 
     // read DB of previously named network interfaces
     S_dblist = readInterfaceList();
@@ -1853,23 +1995,8 @@ setup_IOKit(CFBundleRef bundle)
     }
 
     // add a timer so we don't wait forever for IOKit to quiesce
-    dict = CFBundleGetInfoDictionary(bundle);
-    if (isA_CFDictionary(dict)) {
-       CFNumberRef     num;
-
-       num = CFDictionaryGetValue(dict, CFSTR(WAIT_QUIET_TIMEOUT_KEY));
-       if (num != NULL) {
-           if (!isA_CFNumber(num) ||
-               !CFNumberGetValue(num, kCFNumberDoubleType, &timeout) ||
-               (timeout <= 0.0)) {
-               SCLog(TRUE, LOG_ERR,
-                     CFSTR(MY_PLUGIN_NAME ": " WAIT_QUIET_TIMEOUT_KEY " value error"));
-               timeout = WAIT_QUIET_TIMEOUT_DEFAULT;
-           }
-       }
-    }
     S_timer = CFRunLoopTimerCreate(NULL,
-                                  CFAbsoluteTimeGetCurrent() + timeout,
+                                  CFAbsoluteTimeGetCurrent() + S_stack_timeout,
                                   0,
                                   0,
                                   0,
@@ -1960,7 +2087,6 @@ setup_IOKit(CFBundleRef bundle)
     return ok;
 }
 
-#if    !TARGET_OS_IPHONE
 static Boolean
 setup_Virtual(CFBundleRef bundle)
 {
@@ -1995,29 +2121,55 @@ setup_Virtual(CFBundleRef bundle)
 
     return TRUE;
 }
-#endif /* !TARGET_OS_IPHONE */
 
-__private_extern__
-void
-load_InterfaceNamer(CFBundleRef bundle, Boolean bundleVerbose)
+static void *
+exec_InterfaceNamer(void *arg)
 {
-    if (bundleVerbose) {
-       S_debug = TRUE;
+    CFBundleRef                bundle  = (CFBundleRef)arg;
+    CFDictionaryRef    dict;
+
+#if    !TARGET_OS_EMBEDDED
+    pthread_setname_np(MY_PLUGIN_NAME " thread");
+#endif // !TARGET_OS_EMBEDDED
+
+    dict = CFBundleGetInfoDictionary(bundle);
+    if (isA_CFDictionary(dict)) {
+       CFNumberRef     num;
+
+       num = CFDictionaryGetValue(dict, CFSTR(WAIT_STACK_TIMEOUT_KEY));
+       if (num != NULL) {
+           if (!isA_CFNumber(num) ||
+               !CFNumberGetValue(num, kCFNumberDoubleType, &S_stack_timeout) ||
+               (S_stack_timeout <= 0.0)) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR(MY_PLUGIN_NAME ": " WAIT_STACK_TIMEOUT_KEY " value error"));
+               S_stack_timeout = WAIT_STACK_TIMEOUT_DEFAULT;
+           }
+       }
+
+       num = CFDictionaryGetValue(dict, CFSTR(WAIT_QUIET_TIMEOUT_KEY));
+       if (num != NULL) {
+           if (!isA_CFNumber(num) ||
+               !CFNumberGetValue(num, kCFNumberDoubleType, &S_quiet_timeout) ||
+               (S_quiet_timeout <= 0.0)) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR(MY_PLUGIN_NAME ": " WAIT_QUIET_TIMEOUT_KEY " value error"));
+               S_quiet_timeout = WAIT_QUIET_TIMEOUT_DEFAULT;
+           }
+       }
     }
 
-#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)) {
        goto error;
     }
 
-    return;
+    goto done;
 
   error :
     if (S_connect != MACH_PORT_NULL) {
@@ -2053,6 +2205,41 @@ load_InterfaceNamer(CFBundleRef bundle, Boolean bundleVerbose)
        S_timer = NULL;
     }
 
+  done :
+#if    !TARGET_OS_EMBEDDED
+    CFRelease(bundle);
+    CFRunLoopRun();
+#endif // !TARGET_OS_EMBEDDED
+
+    return NULL;
+}
+
+__private_extern__
+void
+load_InterfaceNamer(CFBundleRef bundle, Boolean bundleVerbose)
+{
+    if (bundleVerbose) {
+       S_debug = TRUE;
+    }
+
+#if    !TARGET_OS_EMBEDDED
+    {
+       pthread_attr_t  tattr;
+       pthread_t       tid;
+
+       CFRetain(bundle);       // released in exec_InterfaceNamer
+
+       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, exec_InterfaceNamer, bundle);
+       pthread_attr_destroy(&tattr);
+    }
+#else  // !TARGET_OS_EMBEDDED
+    (void)exec_InterfaceNamer(bundle);
+#endif // !TARGET_OS_EMBEDDED
+
     return;
 }
 
@@ -2106,3 +2293,22 @@ main(int argc, char ** argv)
     return 0;
 }
 #endif /* TEST_PLATFORM_UUID */
+
+#ifdef TEST_SNAPSHOT
+int
+main(int argc, char ** argv)
+{
+    CFStringRef        snapshot;
+
+    _sc_log     = FALSE;
+    _sc_verbose = (argc > 1) ? TRUE : FALSE;
+
+    snapshot = captureBusy();
+    SCPrint(TRUE, stdout, CFSTR("%@\n"), snapshot);
+    CFRelease(snapshot);
+
+    exit(0);
+    return 0;
+}
+#endif /* TEST_SNAPSHOT */
+
index 0e6f2780cca551cb48bb6821150a6e3082577f8f..995a9300ee7f53b78adf0437b080564e15e93054 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
diff --git a/Plugins/KernelEventMonitor/ev_appletalk.c b/Plugins/KernelEventMonitor/ev_appletalk.c
deleted file mode 100644 (file)
index d48d5e5..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * Copyright (c) 2002-2007 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
- *
- * August 5, 2002      Allan Nathanson <ajn@apple.com>
- * - split code out from eventmon.c
- */
-
-#include "eventmon.h"
-#include "cache.h"
-#include "ev_appletalk.h"
-
-// from <netat/ddp.h>
-#define DDP_MIN_NETWORK        0x0001
-#define DDP_MAX_NETWORK        0xfffe
-
-
-static int
-get_atalk_interface_cfg(const char *if_name, at_if_cfg_t *cfg)
-{
-       int     fd;
-
-       /* open socket */
-       if ((fd = socket(AF_APPLETALK, SOCK_RAW, 0)) == -1)
-               return -1;
-
-       /* get config info for given interface */
-       strncpy(cfg->ifr_name, if_name, sizeof(cfg->ifr_name));
-       if (ioctl(fd, AIOCGETIFCFG, (caddr_t)cfg) == -1) {
-               (void)close(fd);
-               return -1;
-       }
-
-       (void)close(fd);
-       return 0;
-}
-
-
-static CFMutableDictionaryRef
-getIF(CFStringRef key, CFMutableDictionaryRef oldIFs, CFMutableDictionaryRef newIFs)
-{
-       CFDictionaryRef         dict            = NULL;
-       CFMutableDictionaryRef  newDict         = NULL;
-
-       if (CFDictionaryGetValueIfPresent(newIFs, key, (const void **)&dict)) {
-               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
-       } else {
-               dict = cache_SCDynamicStoreCopyValue(store, key);
-               if (dict) {
-                       CFDictionarySetValue(oldIFs, key, dict);
-                       if (isA_CFDictionary(dict)) {
-                               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
-                               CFDictionaryRemoveValue(newDict, kSCPropNetAppleTalkNetworkID);
-                               CFDictionaryRemoveValue(newDict, kSCPropNetAppleTalkNodeID);
-                               CFDictionaryRemoveValue(newDict, kSCPropNetAppleTalkNetworkRange);
-                               CFDictionaryRemoveValue(newDict, kSCPropNetAppleTalkDefaultZone);
-                       }
-                       CFRelease(dict);
-               }
-       }
-
-       if (!newDict) {
-               newDict = CFDictionaryCreateMutable(NULL,
-                                                   0,
-                                                   &kCFTypeDictionaryKeyCallBacks,
-                                                   &kCFTypeDictionaryValueCallBacks);
-       }
-
-       return newDict;
-}
-
-
-static void
-updateStore(const void *key, const void *value, void *context)
-{
-       CFDictionaryRef dict;
-       CFDictionaryRef newDict = (CFDictionaryRef)value;
-       CFDictionaryRef oldIFs  = (CFDictionaryRef)context;
-
-       dict = CFDictionaryGetValue(oldIFs, key);
-
-       if (!dict || !CFEqual(dict, newDict)) {
-               if (CFDictionaryGetCount(newDict) > 0) {
-                       cache_SCDynamicStoreSetValue(store, key, newDict);
-               } else if (dict) {
-                       cache_SCDynamicStoreRemoveValue(store, key);
-               }
-               network_changed = TRUE;
-       }
-
-       return;
-}
-
-
-__private_extern__
-void
-interface_update_appletalk(struct ifaddrs *ifap, const char *if_name)
-{
-       struct ifaddrs          *ifa;
-       struct ifaddrs          *ifap_temp      = NULL;
-       CFStringRef             interface;
-       boolean_t               interfaceFound  = FALSE;
-       CFStringRef             key             = NULL;
-       CFMutableDictionaryRef  oldIFs;
-       CFMutableDictionaryRef  newDict         = NULL;
-       CFMutableDictionaryRef  newIFs;
-
-       oldIFs = CFDictionaryCreateMutable(NULL,
-                                          0,
-                                          &kCFTypeDictionaryKeyCallBacks,
-                                          &kCFTypeDictionaryValueCallBacks);
-       newIFs = CFDictionaryCreateMutable(NULL,
-                                          0,
-                                          &kCFTypeDictionaryKeyCallBacks,
-                                          &kCFTypeDictionaryValueCallBacks);
-
-       if (!ifap) {
-               if (getifaddrs(&ifap_temp) == -1) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
-                       goto error;
-               }
-               ifap = ifap_temp;
-       }
-
-       for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
-               at_if_cfg_t             cfg;
-               int                     iVal;
-               CFNumberRef             num;
-               struct sockaddr_at      *sat;
-
-               if (ifa->ifa_addr->sa_family != AF_APPLETALK) {
-                       continue;                       /* sorry, not interested */
-               }
-
-               /* check if this is the requested interface */
-               if (if_name) {
-                       if (strncmp(if_name, ifa->ifa_name, IFNAMSIZ) == 0) {
-                               interfaceFound = TRUE;  /* yes, this is the one I want */
-                       } else {
-                               continue;               /* sorry, not interested */
-                       }
-               }
-
-               /* get the current cache information */
-               interface = CFStringCreateWithCString(NULL, ifa->ifa_name, kCFStringEncodingMacRoman);
-               key       = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                                         kSCDynamicStoreDomainState,
-                                                                         interface,
-                                                                         kSCEntNetAppleTalk);
-               CFRelease(interface);
-
-               newDict = getIF(key, oldIFs, newIFs);
-
-               sat = (struct sockaddr_at *)ifa->ifa_addr;
-
-               iVal = (int)sat->sat_addr.s_net;
-               num  = CFNumberCreate(NULL, kCFNumberIntType, &iVal);
-               CFDictionarySetValue(newDict, kSCPropNetAppleTalkNetworkID, num);
-               CFRelease(num);
-
-               iVal = (int)sat->sat_addr.s_node;
-               num  = CFNumberCreate(NULL, kCFNumberIntType, &iVal);
-               CFDictionarySetValue(newDict, kSCPropNetAppleTalkNodeID, num);
-               CFRelease(num);
-
-               if (get_atalk_interface_cfg(ifa->ifa_name, &cfg) == 0) {
-                       CFStringRef             zone;
-
-                       /*
-                        * Set starting and ending net values
-                        */
-                       if (!(((cfg.netStart == 0) && (cfg.netEnd == 0)) ||
-                             ((cfg.netStart == DDP_MIN_NETWORK) && (cfg.netEnd == DDP_MAX_NETWORK)))) {
-                               CFMutableArrayRef       array;
-
-                               array = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-
-                               iVal = cfg.netStart;
-                               num  = CFNumberCreate(NULL, kCFNumberIntType, &iVal);
-                               CFArrayAppendValue(array, num);
-                               CFRelease(num);
-
-                               iVal = cfg.netEnd;
-                               num  = CFNumberCreate(NULL, kCFNumberIntType, &iVal);
-                               CFArrayAppendValue(array, num);
-                               CFRelease(num);
-
-                               CFDictionarySetValue(newDict, kSCPropNetAppleTalkNetworkRange, array);
-                               CFRelease(array);
-                       }
-
-                       /*
-                        * Set the default zone
-                        */
-                       zone = CFStringCreateWithPascalString(NULL,
-                                                             (ConstStr255Param)&cfg.zonename,
-                                                             kCFStringEncodingMacRoman);
-                       CFDictionarySetValue(newDict, kSCPropNetAppleTalkDefaultZone, zone);
-                       CFRelease(zone);
-               }
-
-               CFDictionarySetValue(newIFs, key, newDict);
-               CFRelease(newDict);
-               CFRelease(key);
-       }
-
-       /* if the last address[es] were removed from the target interface */
-       if (if_name && !interfaceFound) {
-               interface = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingMacRoman);
-               key       = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                                         kSCDynamicStoreDomainState,
-                                                                         interface,
-                                                                         kSCEntNetAppleTalk);
-               CFRelease(interface);
-
-               newDict = getIF(key, oldIFs, newIFs);
-
-               CFDictionarySetValue(newIFs, key, newDict);
-               CFRelease(newDict);
-               CFRelease(key);
-       }
-
-       CFDictionaryApplyFunction(newIFs, updateStore, oldIFs);
-
-    error :
-
-       if (ifap_temp)  freeifaddrs(ifap_temp);
-       CFRelease(oldIFs);
-       CFRelease(newIFs);
-
-       return;
-}
-
-
-__private_extern__
-void
-interface_update_atalk_address(struct kev_atalk_data *aEvent, const char *if_name)
-{
-       CFStringRef             interface;
-       CFStringRef             key;
-       CFDictionaryRef         dict;
-       CFMutableDictionaryRef  newDict = NULL;
-       CFNumberRef             newNode, newNet;
-       int                     node;
-       int                     net;
-
-       /* get the current cache information */
-       interface = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingMacRoman);
-       key       = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                                 kSCDynamicStoreDomainState,
-                                                                 interface,
-                                                                 kSCEntNetAppleTalk);
-       CFRelease(interface);
-
-       dict = cache_SCDynamicStoreCopyValue(store, key);
-       if (dict) {
-               if (isA_CFDictionary(dict)) {
-                       newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
-               }
-               CFRelease(dict);
-       }
-
-       if (!newDict) {
-               newDict = CFDictionaryCreateMutable(NULL,
-                                                   0,
-                                                   &kCFTypeDictionaryKeyCallBacks,
-                                                   &kCFTypeDictionaryValueCallBacks);
-       }
-
-       /* Update node/net values in cache */
-       node    = (int)aEvent->node_data.address.s_node;
-       net     = (int)aEvent->node_data.address.s_net;
-
-       newNode = CFNumberCreate(NULL, kCFNumberIntType, &node);
-       newNet  = CFNumberCreate(NULL, kCFNumberIntType, &net);
-
-       CFDictionarySetValue(newDict, kSCPropNetAppleTalkNodeID, newNode);
-       CFDictionarySetValue(newDict, kSCPropNetAppleTalkNetworkID, newNet);
-
-       CFRelease(newNode);
-       CFRelease(newNet);
-
-       /* update cache */
-       cache_SCDynamicStoreSetValue(store, key, newDict);
-       network_changed = TRUE;
-       CFRelease(newDict);
-       CFRelease(key);
-       return;
-}
-
-
-__private_extern__
-void
-interface_update_atalk_zone(struct kev_atalk_data *aEvent, const char *if_name)
-{
-       CFStringRef             interface;
-       CFStringRef             key;
-       CFDictionaryRef         dict;
-       CFMutableDictionaryRef  newDict = NULL;
-       CFStringRef             newZone;
-
-       /* get the current cache information */
-       interface = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingMacRoman);
-       key       = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                                 kSCDynamicStoreDomainState,
-                                                                 interface,
-                                                                 kSCEntNetAppleTalk);
-       CFRelease(interface);
-
-       dict = cache_SCDynamicStoreCopyValue(store, key);
-       if (dict) {
-               if (isA_CFDictionary(dict)) {
-                       newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
-               }
-               CFRelease(dict);
-       }
-
-       if (!newDict) {
-               newDict = CFDictionaryCreateMutable(NULL,
-                                                   0,
-                                                   &kCFTypeDictionaryKeyCallBacks,
-                                                   &kCFTypeDictionaryValueCallBacks);
-       }
-
-       /* Update zone value in cache */
-       newZone = CFStringCreateWithPascalString(NULL, (ConstStr255Param)&(aEvent->node_data.zone), kCFStringEncodingMacRoman);
-
-       CFDictionarySetValue(newDict, kSCPropNetAppleTalkDefaultZone, newZone);
-
-       CFRelease(newZone);
-
-       /* update cache */
-       cache_SCDynamicStoreSetValue(store, key, newDict);
-       network_changed = TRUE;
-       CFRelease(newDict);
-       CFRelease(key);
-       return;
-}
-
-
-__private_extern__
-void
-interface_update_shutdown_atalk()
-{
-       CFStringRef                     cacheKey;
-       CFDictionaryRef                 dict;
-       CFArrayRef                      ifList = NULL;
-       CFIndex                         count, index;
-       CFStringRef                     interface;
-       CFStringRef                     key;
-
-       cacheKey  = SCDynamicStoreKeyCreateNetworkInterface(NULL,
-                                                           kSCDynamicStoreDomainState);
-
-       dict = cache_SCDynamicStoreCopyValue(store, cacheKey);
-       CFRelease(cacheKey);
-
-       if (dict) {
-               if (isA_CFDictionary(dict)) {
-                       /*get a list of the interfaces*/
-                       ifList  = isA_CFArray(CFDictionaryGetValue(dict, kSCPropNetInterfaces));
-                       if (ifList) {
-                               count = CFArrayGetCount(ifList);
-
-                               /*iterate through list and remove AppleTalk data*/
-                               for (index = 0; index < count; index++) {
-                                       interface = CFArrayGetValueAtIndex(ifList, index);
-                                       key       = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                                                                 kSCDynamicStoreDomainState,
-                                                                                                 interface,
-                                                                                                 kSCEntNetAppleTalk);
-                                       cache_SCDynamicStoreRemoveValue(store, key);
-                                       network_changed = TRUE;
-                                       CFRelease(key);
-                               }
-                       }
-               }
-               CFRelease(dict);
-       }
-
-       return;
-}
diff --git a/Plugins/KernelEventMonitor/ev_appletalk.h b/Plugins/KernelEventMonitor/ev_appletalk.h
deleted file mode 100644 (file)
index f02f722..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, 2005 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@
- */
-
-/*
- * Modification History
- *
- * August 5, 2002      Allan Nathanson <ajn@apple.com>
- * - split code out from eventmon.c
- */
-
-
-#ifndef _EV_APPLETALK_H
-#define _EV_APPLETALK_H
-
-#include <netat/appletalk.h>
-#include <netat/at_var.h>
-
-__BEGIN_DECLS
-
-void   interface_update_appletalk      (struct ifaddrs *ifap, const char *if_name);
-void   interface_update_atalk_address  (struct kev_atalk_data *aEvent, const char *if_name);
-void   interface_update_atalk_zone     (struct kev_atalk_data *aEvent, const char *if_name);
-void   interface_update_shutdown_atalk ();
-
-__END_DECLS
-
-#endif /* _EV_EVENTMON_H */
-
index bc24c8fe11d2c3d6e6c7fc649476c83c91b8a4cc..10792c0b517f63bbde03bd910511b0c5e42caf7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -60,9 +60,8 @@
 #include "ev_ipv6.h"
 #include <notify.h>
 
-#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
-#include "ev_appletalk.h"
-#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */
+// from ip_fw2.c
+#define KEV_LOG_SUBCLASS       10
 
 static const char *inetEventName[] = {
        "",
@@ -73,6 +72,7 @@ static const char *inetEventName[] = {
        "INET broadcast address changed",
        "INET netmask changed",
        "INET ARP collision",
+       "INET port in use",
 };
 
 static const char *dlEventName[] = {
@@ -92,21 +92,13 @@ static const char *dlEventName[] = {
        "KEV_DL_LINK_ON",
        "KEV_DL_PROTO_ATTACHED",
        "KEV_DL_PROTO_DETACHED",
+       "KEV_DL_LINK_ADDRESS_CHANGED",
+       "KEV_DL_WAKEFLAGS_CHANGED",
+#ifdef KEV_DL_IF_IDLE_ROUTE_REFCNT
+       "KEV_DL_IF_IDLE_ROUTE_REFCNT",
+#endif // KEV_DL_IF_IDLE_ROUTE_REFCNT
 };
 
-#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
-static const char *atalkEventName[] = {
-       "",
-       "KEV_ATALK_ENABLED",
-       "KEV_ATALK_DISABLED",
-       "KEV_ATALK_ZONEUPDATED",
-       "KEV_ATALK_ROUTERUP",
-       "KEV_ATALK_ROUTERUP_INVALID",
-       "KEV_ATALK_ROUTERDOWN",
-       "KEV_ATALK_ZONELISTCHANGED"
-};
-#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */
-
 static const char *inet6EventName[] = {
        "",
        "KEV_INET6_NEW_USER_ADDR",
@@ -135,7 +127,7 @@ ifflags_set(int s, char * name, short flags)
     int                ret;
 
     bzero(&ifr, sizeof(ifr));
-    strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+    strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
     ret = ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr);
     if (ret == -1) {
                return (ret);
@@ -151,7 +143,7 @@ ifflags_clear(int s, char * name, short flags)
     int                ret;
 
     bzero(&ifr, sizeof(ifr));
-    strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+    strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
     ret = ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr);
     if (ret == -1) {
                return (ret);
@@ -203,8 +195,12 @@ logEvent(CFStringRef evStr, struct kern_event_msg *ev_msg)
        int     i;
        int     j;
 
-       SCLog(_verbose, LOG_DEBUG, CFSTR("%@ event:"), evStr);
-       SCLog(_verbose, LOG_DEBUG,
+       if (!_verbose) {
+               return;
+       }
+
+       SCLog(TRUE, LOG_DEBUG, CFSTR("%@ event:"), evStr);
+       SCLog(TRUE, LOG_DEBUG,
              CFSTR("  Event size=%d, id=%d, vendor=%d, class=%d, subclass=%d, code=%d"),
              ev_msg->total_size,
              ev_msg->id,
@@ -213,14 +209,14 @@ logEvent(CFStringRef evStr, struct kern_event_msg *ev_msg)
              ev_msg->kev_subclass,
              ev_msg->event_code);
        for (i = 0, j = KEV_MSG_HEADER_SIZE; j < ev_msg->total_size; i++, j+=4) {
-               SCLog(_verbose, LOG_DEBUG, CFSTR("  Event data[%2d] = %08lx"), i, ev_msg->event_data[i]);
+               SCLog(TRUE, LOG_DEBUG, CFSTR("  Event data[%2d] = %08lx"), i, ev_msg->event_data[i]);
        }
 }
 
 static const char *
 inetEventNameString(uint32_t event_code)
 {
-       if (event_code <= KEV_INET_ARPCOLLISION) {
+       if (event_code < sizeof(inetEventName) / sizeof(inetEventName[0])) {
                return (inetEventName[event_code]);
        }
        return ("New Apple network INET subcode");
@@ -229,7 +225,7 @@ inetEventNameString(uint32_t event_code)
 static const char *
 inet6EventNameString(uint32_t event_code)
 {
-       if (event_code <= KEV_INET6_DEFROUTER) {
+       if (event_code < sizeof(inet6EventName) / sizeof(inet6EventName[0])) {
                return (inet6EventName[event_code]);
        }
        return ("New Apple network INET6 subcode");
@@ -238,23 +234,12 @@ inet6EventNameString(uint32_t event_code)
 static const char *
 dlEventNameString(uint32_t event_code)
 {
-       if (event_code <= KEV_DL_PROTO_DETACHED) {
+       if (event_code < sizeof(dlEventName) / sizeof(dlEventName[0])) {
                return (dlEventName[event_code]);
        }
        return ("New Apple network DL subcode");
 }
 
-#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
-static const char *
-atalkEventNameString(uint32_t event_code)
-{
-       if (event_code <= KEV_ATALK_ZONELISTCHANGED) {
-               return (atalkEventName[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)
 {
@@ -269,7 +254,7 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
        int                             dataLen = (ev_msg->total_size - KEV_MSG_HEADER_SIZE);
        void *                          event_data = &ev_msg->event_data[0];
        Boolean                         handled = TRUE;
-       char                            ifr_name[IFNAMSIZ + 1];
+       char                            ifr_name[IFNAMSIZ];
 
        switch (ev_msg->kev_subclass) {
                case KEV_INET_SUBCLASS : {
@@ -394,17 +379,6 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
                                        interface_detaching(ifr_name);
                                        break;
 
-                               case KEV_DL_SIFFLAGS :
-                               case KEV_DL_SIFMETRICS :
-                               case KEV_DL_SIFMTU :
-                               case KEV_DL_SIFPHYS :
-                               case KEV_DL_SIFMEDIA :
-                               case KEV_DL_SIFGENERIC :
-                               case KEV_DL_ADDMULTI :
-                               case KEV_DL_DELMULTI :
-                                       handled = FALSE;
-                                       break;
-
                                case KEV_DL_PROTO_ATTACHED :
                                case KEV_DL_PROTO_DETACHED : {
                                        struct kev_dl_proto_data * protoEvent;
@@ -437,43 +411,19 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
                                        link_update_status(ifr_name, FALSE);
                                        break;
 
-                               default :
-                                       handled = FALSE;
-                                       break;
-                       }
-                       break;
-               }
-#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
-               case KEV_ATALK_SUBCLASS: {
-                       struct kev_atalk_data * ev;
-
-                       eventName = atalkEventNameString(ev_msg->event_code);
-                       ev = (struct kev_atalk_data *)event_data;
-                       if (dataLen < sizeof(*ev)) {
-                               handled = FALSE;
-                               break;
-                       }
-                       copy_if_name(&ev->link_data, ifr_name, sizeof(ifr_name));
-                       switch (ev_msg->event_code) {
-                               case KEV_ATALK_ENABLED:
-                                       interface_update_atalk_address(ev, ifr_name);
-                                       break;
-
-                               case KEV_ATALK_DISABLED:
-                                       interface_update_shutdown_atalk();
-                                       break;
-
-                               case KEV_ATALK_ZONEUPDATED:
-                                       interface_update_atalk_zone(ev, ifr_name);
-                                       break;
-
-                               case KEV_ATALK_ROUTERUP:
-                               case KEV_ATALK_ROUTERUP_INVALID:
-                               case KEV_ATALK_ROUTERDOWN:
-                                       interface_update_appletalk(NULL, ifr_name);
-                                       break;
-
-                               case KEV_ATALK_ZONELISTCHANGED:
+                               case KEV_DL_SIFFLAGS :
+                               case KEV_DL_SIFMETRICS :
+                               case KEV_DL_SIFMTU :
+                               case KEV_DL_SIFPHYS :
+                               case KEV_DL_SIFMEDIA :
+                               case KEV_DL_SIFGENERIC :
+                               case KEV_DL_ADDMULTI :
+                               case KEV_DL_DELMULTI :
+                               case KEV_DL_LINK_ADDRESS_CHANGED :
+                               case KEV_DL_WAKEFLAGS_CHANGED :
+#ifdef KEV_DL_IF_IDLE_ROUTE_REFCNT
+                               case KEV_DL_IF_IDLE_ROUTE_REFCNT :
+#endif // KEV_DL_IF_IDLE_ROUTE_REFCNT
                                        break;
 
                                default :
@@ -482,7 +432,9 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
                        }
                        break;
                }
-#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */
+               case KEV_LOG_SUBCLASS : {
+                       break;
+               }
                default :
                        handled = FALSE;
                        break;
@@ -500,30 +452,6 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
        return;
 }
 
-static void
-processEvent_Apple_IOKit(struct kern_event_msg *ev_msg)
-{
-       switch (ev_msg->kev_subclass) {
-               default :
-                       logEvent(CFSTR("New Apple IOKit subclass"), ev_msg);
-                       break;
-       }
-
-       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)
 {
@@ -554,10 +482,10 @@ eventCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const
                                                processEvent_Apple_Network(ev_msg);
                                                break;
                                        case KEV_IOKIT_CLASS :
-                                               processEvent_Apple_IOKit(ev_msg);
-                                               break;
                                        case KEV_SYSTEM_CLASS :
-                                               processEvent_Apple_System(ev_msg);
+                                       case KEV_APPLESHARE_CLASS :
+                                       case KEV_FIREWALL_CLASS :
+                                       case KEV_IEEE80211_CLASS :
                                                break;
                                        default :
                                                /* unrecognized (Apple) event class */
@@ -636,14 +564,6 @@ 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);
 
  done:
@@ -702,10 +622,10 @@ load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose)
        /* Open an event socket */
        so = socket(PF_SYSTEM, SOCK_RAW, SYSPROTO_EVENT);
        if (so != -1) {
-               /* 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 */
+               /* establish filter to return events of interest */
+               kev_req.vendor_code  = KEV_VENDOR_APPLE;
+               kev_req.kev_class    = KEV_NETWORK_CLASS;
+               kev_req.kev_subclass = KEV_ANY_SUBCLASS;
                status = ioctl(so, SIOCSKEVFILT, &kev_req);
                if (status) {
                        SCLog(TRUE, LOG_ERR, CFSTR("could not establish event filter, ioctl() failed: %s"), strerror(errno));
@@ -769,14 +689,6 @@ 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
deleted file mode 100644 (file)
index ca15b27..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>CFBundleDevelopmentRegion</key>
-       <string>English</string>
-       <key>CFBundleExecutable</key>
-       <string>Kicker</string>
-       <key>CFBundleIdentifier</key>
-       <string>com.apple.SystemConfiguration.Kicker</string>
-       <key>CFBundleInfoDictionaryVersion</key>
-       <string>6.0</string>
-       <key>CFBundleName</key>
-       <string>com.apple.SystemConfiguration.Kicker</string>
-       <key>CFBundlePackageType</key>
-       <string>BNDL</string>
-       <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
-       <key>CFBundleSignature</key>
-       <string>????</string>
-       <key>CFBundleVersion</key>
-       <string>1.10.2</string>
-       <key>Requires</key>
-       <array>
-               <string>com.apple.SystemConfiguration.ATconfig</string>
-               <string>com.apple.SystemConfiguration.IPConfiguration</string>
-               <string>com.apple.SystemConfiguration.IPMonitor</string>
-       </array>
-       <key>Builtin</key>
-       <true/>
-</dict>
-</plist>
diff --git a/Plugins/Kicker/Kicker.xml b/Plugins/Kicker/Kicker.xml
deleted file mode 100644 (file)
index db550c4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<array>
-       <dict>
-               <key>execCommand</key>
-               <string>$BUNDLE/Contents/Resources/enable-network</string>
-               <key>execUID</key>
-               <integer>0</integer>
-               <key>keys</key>
-               <array>
-                       <string>State:/Network/Global/IPv4</string>
-               </array>
-               <key>name</key>
-               <string>enable-network</string>
-       </dict>
-</array>
-</plist>
diff --git a/Plugins/Kicker/enable-network b/Plugins/Kicker/enable-network
deleted file mode 100755 (executable)
index 106de56..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-#
-# network configuration has changed
-#
-logger -i -p daemon.debug -t enable-network "process network configuration change"
-
-. /etc/rc.common
-CheckForNetwork
-if [ "${NETWORKUP}" = "-NO-" ]; then exit 0; fi
-
-if [ -x /System/Library/StartupItems/NetworkTime/NetworkTime ]; then
-       /System/Library/StartupItems/NetworkTime/NetworkTime start
-fi
-
-if [ -x /System/Library/StartupItems/NIS/NIS ]; then
-       /System/Library/StartupItems/NIS/NIS start
-fi
-
-if [ -x /System/Library/StartupItems/NFS/NFS ]; then
-       /System/Library/StartupItems/NFS/NFS start
-fi
-
-exit 1
diff --git a/Plugins/Kicker/kicker.c b/Plugins/Kicker/kicker.c
deleted file mode 100644 (file)
index ad552d2..0000000
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * Copyright (c) 2000-2005 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@
- */
-
-/*
- * Modification History
- *
- * April 16, 2002              Allan Nathanson <ajn@apple.com>
- * - updated to use _SCDPluginExecCommand()
- *
- * June 23, 2001               Allan Nathanson <ajn@apple.com>
- * - updated to public SystemConfiguration.framework APIs
- *
- * June 4, 2001                        Allan Nathanson <ajn@apple.com>
- * - add changed keys as the arguments to the kicker script
- *
- * June 30, 2000               Allan Nathanson <ajn@apple.com>
- * - initial revision
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <notify.h>
-
-#include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCPrivate.h>     // for SCLog()
-#include <SystemConfiguration/SCDPlugin.h>
-#include <SystemConfiguration/SCValidation.h>
-
-/*
- * Information maintained for each to-be-kicked registration.
- */
-typedef struct {
-       boolean_t               active;
-       boolean_t               needsKick;
-
-       /* dictionary associated with this target */
-       CFDictionaryRef         dict;
-
-       /* SCDynamicStore session information for this target */
-       CFRunLoopRef            rl;
-       CFRunLoopSourceRef      rls;
-       SCDynamicStoreRef       store;
-
-       /* changed keys */
-       CFMutableArrayRef       changedKeys;
-} kickee, *kickeeRef;
-
-static CFURLRef        myBundleURL     = NULL;
-static Boolean _verbose        = FALSE;
-
-static void booter(kickeeRef target);
-static void booterExit(pid_t pid, int status, struct rusage *rusage, void *context);
-
-
-static void
-cleanupKicker(kickeeRef target)
-{
-       CFStringRef             name    = CFDictionaryGetValue(target->dict, CFSTR("name"));
-
-       SCLog(TRUE, LOG_NOTICE,
-             CFSTR("  target=%@: disabled"),
-             name);
-       CFRunLoopRemoveSource(target->rl, target->rls, kCFRunLoopDefaultMode);
-       CFRelease(target->rls);
-       CFRelease(target->store);
-       if (target->dict)               CFRelease(target->dict);
-       if (target->changedKeys)        CFRelease(target->changedKeys);
-       CFAllocatorDeallocate(NULL, target);
-}
-
-
-static void
-booter(kickeeRef target)
-{
-       char                    **argv          = NULL;
-       char                    *cmd            = NULL;
-       CFStringRef             execCommand     = CFDictionaryGetValue(target->dict, CFSTR("execCommand"));
-       int                     i;
-       CFArrayRef              keys            = NULL;
-       CFStringRef             name            = CFDictionaryGetValue(target->dict, CFSTR("name"));
-       int                     nKeys           = 0;
-       Boolean                 ok              = FALSE;
-       CFStringRef             postName        = CFDictionaryGetValue(target->dict, CFSTR("postName"));
-
-       if (target->active) {
-               /* we need another kick! */
-               target->needsKick = TRUE;
-
-               SCLog(_verbose, LOG_DEBUG, CFSTR("Kicker callback, target=%@ request queued"), name);
-               return;
-       }
-
-       SCLog(_verbose, LOG_DEBUG, CFSTR("Kicker callback, target=%@"), name);
-
-       if (!isA_CFString(postName) && !isA_CFString(execCommand)) {
-               goto error;     /* if no notifications to post nor commands to execute */
-       }
-
-       if (isA_CFString(postName)) {
-               uint32_t        status;
-
-               /*
-                * post a notification
-                */
-               cmd = _SC_cfstring_to_cstring(postName, NULL, 0, kCFStringEncodingASCII);
-               if (!cmd) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("  could not convert post name to C string"));
-                       goto error;
-               }
-
-               SCLog(TRUE, LOG_NOTICE, CFSTR("posting notification %s"), cmd);
-               status = notify_post(cmd);
-               if (status != NOTIFY_STATUS_OK) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("  notify_post() failed: error=%ld"), status);
-                       goto error;
-               }
-
-               CFAllocatorDeallocate(NULL, cmd);       /* clean up */
-               cmd = NULL;
-       }
-
-       /*
-        * get the arguments for the kickee
-        */
-       keys = target->changedKeys;
-       target->changedKeys = NULL;
-
-       if (isA_CFString(execCommand)) {
-               CFRange                 bpr;
-               CFNumberRef             execGID         = CFDictionaryGetValue(target->dict, CFSTR("execGID"));
-               CFNumberRef             execUID         = CFDictionaryGetValue(target->dict, CFSTR("execUID"));
-               CFBooleanRef            passKeys        = CFDictionaryGetValue(target->dict, CFSTR("changedKeysAsArguments"));
-               gid_t                   reqGID          = 0;
-               uid_t                   reqUID          = 0;
-               CFMutableStringRef      str;
-
-               /*
-                * build the kickee command
-                */
-               str = CFStringCreateMutableCopy(NULL, 0, execCommand);
-               bpr = CFStringFind(str, CFSTR("$BUNDLE"), 0);
-               if (bpr.location != kCFNotFound) {
-                       CFStringRef     bundlePath;
-
-                       bundlePath = CFURLCopyFileSystemPath(myBundleURL, kCFURLPOSIXPathStyle);
-                       CFStringReplace(str, bpr, bundlePath);
-                       CFRelease(bundlePath);
-               }
-
-               cmd = _SC_cfstring_to_cstring(str, NULL, 0, kCFStringEncodingASCII);
-               CFRelease(str);
-               if (!cmd) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("  could not convert command to C string"));
-                       goto error;
-               }
-
-               /*
-                * get the UID/GID for the kickee
-                */
-               if (isA_CFNumber(execUID)) {
-                       CFNumberGetValue(execUID, kCFNumberIntType, &reqUID);
-               }
-
-               if (isA_CFNumber(execGID)) {
-                       CFNumberGetValue(execGID, kCFNumberIntType, &reqGID);
-               }
-
-               nKeys = CFArrayGetCount(keys);
-               argv  = CFAllocatorAllocate(NULL, (nKeys + 2) * sizeof(char *), 0);
-               for (i = 0; i < (nKeys + 2); i++) {
-                       argv[i] = NULL;
-               }
-
-               /* create command name argument */
-               if ((argv[0] = rindex(cmd, '/')) != NULL) {
-                       argv[0]++;
-               } else {
-                       argv[0] = cmd;
-               }
-
-               /* create changed key arguments */
-               if (isA_CFBoolean(passKeys) && CFBooleanGetValue(passKeys)) {
-                       for (i = 0; i < nKeys; i++) {
-                               CFStringRef     key = CFArrayGetValueAtIndex(keys, i);
-
-                               argv[i+1] = _SC_cfstring_to_cstring(key, NULL, 0, kCFStringEncodingASCII);
-                               if (!argv[i+1]) {
-                                       SCLog(TRUE, LOG_DEBUG, CFSTR("  could not convert argument to C string"));
-                                       goto error;
-                               }
-                       }
-               }
-
-               SCLog(TRUE,     LOG_NOTICE, CFSTR("executing %s"), cmd);
-               SCLog(_verbose, LOG_DEBUG,  CFSTR("  current uid = %d, requested = %d"), geteuid(), reqUID);
-
-               /* this kicker is now "running" */
-               target->active = TRUE;
-
-               (void)_SCDPluginExecCommand(booterExit,
-                             target,
-                             reqUID,
-                             reqGID,
-                             cmd,
-                             argv);
-
-//             CFAllocatorDeallocate(NULL, cmd);       /* clean up */
-//             cmd = NULL;
-       }
-       ok = TRUE;
-
-    error :
-
-       if (keys)       CFRelease(keys);
-       if (cmd)        CFAllocatorDeallocate(NULL, cmd);
-       if (argv) {
-               for (i = 0; i < nKeys; i++) {
-                       if (argv[i+1]) {
-                               CFAllocatorDeallocate(NULL, argv[i+1]);
-                       }
-               }
-               CFAllocatorDeallocate(NULL, argv);
-       }
-
-       if (!ok) {
-               /*
-                * If the target action can't be performed this time then
-                * there's not much point in trying again. As such, I close
-                * the session and the kickee target released.
-                */
-               cleanupKicker(target);
-       }
-
-       return;
-}
-
-
-static void
-booterExit(pid_t pid, int status, struct rusage *rusage, void *context)
-{
-       CFStringRef     name;
-       Boolean         ok      = TRUE;
-       kickeeRef       target  = (kickeeRef)context;
-
-       name = CFDictionaryGetValue(target->dict, CFSTR("name"));
-       target->active = FALSE;
-       if (WIFEXITED(status)) {
-               SCLog(TRUE, LOG_DEBUG,
-                     CFSTR("  target=%@: exit status = %d"),
-                     name,
-                     WEXITSTATUS(status));
-               if (WEXITSTATUS(status) != 0) {
-                       ok = FALSE;
-               }
-       } else if (WIFSIGNALED(status)) {
-               SCLog(TRUE, LOG_DEBUG,
-                     CFSTR("  target=%@: terminated w/signal = %d"),
-                     name,
-                     WTERMSIG(status));
-               ok = FALSE;
-       } else {
-               SCLog(TRUE, LOG_DEBUG,
-                     CFSTR("  target=%@: exit status = %d"),
-                     name,
-                     status);
-               ok = FALSE;
-       }
-
-       if (!ok) {
-               if (CFDictionaryContainsKey(target->dict, CFSTR("postName"))) {
-                       CFDictionaryRef         oldDict = target->dict;
-                       CFMutableDictionaryRef  newDict = CFDictionaryCreateMutableCopy(NULL, 0, oldDict);
-
-                       /*
-                        * if this target specifies both a BSD notification and
-                        * a script to be executed then we want to continue to
-                        * post the BSD notifications (and not execute the
-                        * script).  As such, remove the script reference from
-                        * the dictionary.
-                        */
-                       CFDictionaryRemoveValue(newDict, CFSTR("execCommand"));
-                       CFDictionaryRemoveValue(newDict, CFSTR("execGID"));
-                       CFDictionaryRemoveValue(newDict, CFSTR("execUID"));
-                       CFDictionaryRemoveValue(newDict, CFSTR("changedKeysAsArguments"));
-                       target->dict = newDict;
-                       CFRelease(oldDict);
-               } else {
-                       /*
-                        * If the target action can't be performed this time then
-                        * there's not much point in trying again. As such, I close
-                        * the session and the kickee target released.
-                        */
-                       cleanupKicker(target);
-                       target = NULL;
-               }
-       }
-       if (target != NULL && target->needsKick) {
-               target->needsKick = FALSE;
-               booter(target);
-       }
-
-       return;
-}
-
-
-static void
-kicker(SCDynamicStoreRef store, CFArrayRef changedKeys, void *arg)
-{
-       CFIndex         i;
-       CFIndex         n               = CFArrayGetCount(changedKeys);
-       kickeeRef       target          = (kickeeRef)arg;
-
-       /*
-        * Start a new kicker.  If a kicker was already active then flag
-        * the need for a second kick after the active one completes.
-        */
-
-       /* create (or add to) the full list of keys that have changed */
-       if (!target->changedKeys) {
-               target->changedKeys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-       }
-       for (i = 0; i < n; i++) {
-               CFStringRef     key = CFArrayGetValueAtIndex(changedKeys, i);
-
-               if (!CFArrayContainsValue(target->changedKeys,
-                                         CFRangeMake(0, CFArrayGetCount(target->changedKeys)),
-                                         key)) {
-                       CFArrayAppendValue(target->changedKeys, key);
-               }
-       }
-
-       /*
-        * let 'er rip.
-        */
-       booter(target);
-
-       return;
-}
-
-
-/*
- * startKicker()
- *
- * The first argument is a dictionary representing the keys
- * which need to be monitored for a given "target" and what
- * action should be taken if a change in one of those keys
- * is detected.
- */
-static void
-startKicker(const void *value, void *context)
-{
-       CFMutableStringRef      name;
-       CFArrayRef              keys;
-       CFArrayRef              patterns;
-       kickeeRef               target          = CFAllocatorAllocate(NULL, sizeof(kickee), 0);
-       SCDynamicStoreContext   targetContext   = { 0, (void *)target, NULL, NULL, NULL };
-
-       target->active          = FALSE;
-       target->needsKick       = FALSE;
-       target->dict            = CFRetain((CFDictionaryRef)value);
-       target->store           = NULL;
-       target->rl              = NULL;
-       target->rls             = NULL;
-       target->changedKeys     = NULL;
-
-       name = CFStringCreateMutableCopy(NULL,
-                                        0,
-                                        CFDictionaryGetValue(target->dict, CFSTR("name")));
-       SCLog(TRUE, LOG_DEBUG, CFSTR("Starting kicker for %@"), name);
-
-       CFStringAppend(name, CFSTR(" \"Kicker\""));
-       target->store = SCDynamicStoreCreate(NULL, name, kicker, &targetContext);
-       CFRelease(name);
-       if (!target->store) {
-               SCLog(TRUE,
-                     LOG_NOTICE,
-                     CFSTR("SCDynamicStoreCreate() failed: %s"),
-                     SCErrorString(SCError()));
-               goto error;
-       }
-
-       keys     = isA_CFArray(CFDictionaryGetValue(target->dict, CFSTR("keys")));
-       patterns = isA_CFArray(CFDictionaryGetValue(target->dict, CFSTR("regexKeys")));
-       if (!SCDynamicStoreSetNotificationKeys(target->store, keys, patterns)) {
-               SCLog(TRUE,
-                     LOG_NOTICE,
-                     CFSTR("SCDynamicStoreSetNotifications() failed: %s"),
-                     SCErrorString(SCError()));
-               goto error;
-       }
-
-       target->rl  = CFRunLoopGetCurrent();
-       target->rls = SCDynamicStoreCreateRunLoopSource(NULL, target->store, 0);
-       if (!target->rls) {
-               SCLog(TRUE,
-                     LOG_NOTICE,
-                     CFSTR("SCDynamicStoreCreateRunLoopSource() failed: %s"),
-                     SCErrorString(SCError()));
-               goto error;
-       }
-
-       CFRunLoopAddSource(target->rl, target->rls, kCFRunLoopDefaultMode);
-       return;
-
-    error :
-
-       CFRelease(target->dict);
-       if (target->store)      CFRelease(target->store);
-       CFAllocatorDeallocate(NULL, target);
-       return;
-}
-
-
-static CFArrayRef
-getTargets(CFBundleRef bundle)
-{
-       Boolean                 ok;
-       CFArrayRef              targets;        /* The array of dictionaries
-                                                  representing targets with
-                                                  a "kick me" sign posted on
-                                                  their backs. */
-       CFURLRef                url;
-       CFStringRef             xmlError;
-       CFDataRef               xmlTargets      = NULL;
-
-       /* locate the Kicker targets */
-       url = CFBundleCopyResourceURL(bundle, CFSTR("Kicker"), CFSTR("xml"), NULL);
-       if (url == NULL) {
-               return NULL;
-       }
-
-       /* read the resource data */
-       ok = CFURLCreateDataAndPropertiesFromResource(NULL, url, &xmlTargets, NULL, NULL, NULL);
-       CFRelease(url);
-       if (!ok || (xmlTargets == NULL)) {
-               return NULL;
-       }
-
-       /* convert the XML data into a property list */
-       targets = CFPropertyListCreateFromXMLData(NULL,
-                                                 xmlTargets,
-                                                 kCFPropertyListImmutable,
-                                                 &xmlError);
-       CFRelease(xmlTargets);
-       if (targets == NULL) {
-               if (xmlError != NULL) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("getTargets(): %@"), xmlError);
-                       CFRelease(xmlError);
-               }
-               return NULL;
-       }
-
-       if (!isA_CFArray(targets)) {
-               CFRelease(targets);
-               targets = NULL;
-       }
-
-       return targets;
-}
-
-
-__private_extern__
-void
-load_Kicker(CFBundleRef bundle, Boolean bundleVerbose)
-{
-       CFArrayRef      targets;        /* The array of dictionaries representing targets
-                                        * with a "kick me" sign posted on their backs.*/
-
-       if (bundleVerbose) {
-               _verbose = TRUE;
-       }
-
-       SCLog(_verbose, LOG_DEBUG, CFSTR("load() called"));
-       SCLog(_verbose, LOG_DEBUG, CFSTR("  bundle ID = %@"), CFBundleGetIdentifier(bundle));
-
-       /* get the bundle's URL */
-       myBundleURL = CFBundleCopyBundleURL(bundle);
-       if (myBundleURL == NULL) {
-               return;
-       }
-
-       /* get the targets */
-       targets = getTargets(bundle);
-       if (targets == NULL) {
-               /* if nothing to do */
-               CFRelease(myBundleURL);
-               return;
-       }
-
-       /* start a kicker for each target */
-       CFArrayApplyFunction(targets,
-                            CFRangeMake(0, CFArrayGetCount(targets)),
-                            startKicker,
-                            NULL);
-       CFRelease(targets);
-
-       return;
-}
-
-#ifdef MAIN
-int
-main(int argc, char * const argv[])
-{
-       _sc_log     = FALSE;
-       _sc_verbose = (argc > 1) ? TRUE : FALSE;
-
-       load_Kicker(CFBundleGetMainBundle(), (argc > 1) ? TRUE : FALSE);
-       CFRunLoopRun();
-       /* not reached */
-       exit(0);
-       return 0;
-}
-#endif
index addfd0e89a32c641c1aed91a3ceb69e87582115b..a4e758fd4d708a232c14714353b9f5a405dd2f60 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
diff --git a/Plugins/LinkConfiguration/Makefile b/Plugins/LinkConfiguration/Makefile
new file mode 100644 (file)
index 0000000..135a805
--- /dev/null
@@ -0,0 +1,12 @@
+all : linkconfig
+
+linkconfig.o: linkconfig.c Makefile
+       cc -I../../SystemConfiguration.fproj -Wall -g -DMAIN -O0 -c linkconfig.c
+
+linkconfig: linkconfig.o Makefile
+#      cc -o linkconfig linkconfig.c -framework CoreFoundation -framework SystemConfiguration -framework IOKit
+       cc -o linkconfig linkconfig.o -framework CoreFoundation -framework SystemConfiguration
+
+clean:
+       rm -rf *.o linkconfig linkconfig.dSYM
+
index b0d89df0a762d797a0c0c7d0463f1fb6d6834950..3f73f2ee85a3c4cede4b9c91f0a8b942ed1627b1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2007, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -31,7 +31,6 @@
 
 #include <stdio.h>
 #include <unistd.h>
-//#include <sys/fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
@@ -44,6 +43,8 @@
 #include <SystemConfiguration/LinkConfiguration.h>
 #include <SystemConfiguration/SCDPlugin.h>             // for _SCDPluginExecCommand
 
+#include "SCNetworkConfigurationInternal.h"
+
 
 static CFMutableDictionaryRef  baseSettings    = NULL;
 static CFStringRef             interfacesKey   = NULL;
@@ -54,9 +55,87 @@ static CFMutableDictionaryRef        wantSettings    = NULL;
 static Boolean                 _verbose        = FALSE;
 
 
-/* in SystemConfiguration/LinkConfiguration.c */
-int
-__createMediaOptions(CFStringRef interfaceName, CFDictionaryRef media_options);
+#pragma mark -
+#pragma mark Capabilities
+
+
+#define        CAPABILITIES_KEY        CFSTR("_CAPABILITIES_")
+
+
+__private_extern__
+Boolean
+_SCNetworkInterfaceSetCapabilities(SCNetworkInterfaceRef       interface,
+                                  CFDictionaryRef              options)
+{
+       CFDictionaryRef baseOptions;
+       int             cap_base;
+       int             cap_current;
+       int             cap_requested;
+       CFStringRef     interfaceName;
+
+#ifdef SIOCSIFCAP
+       struct ifreq    ifr;
+       int             ret;
+       int             sock;
+#endif // SIOCSIFCAP
+
+       interfaceName = SCNetworkInterfaceGetBSDName(interface);
+       if (interfaceName == NULL) {
+               /* if no BSD interface name */
+               return FALSE;
+       }
+
+       cap_current = __SCNetworkInterfaceCreateCapabilities(interface, -1, NULL);
+       if (cap_current == -1) {
+               /* could not get current capabilities */
+               return FALSE;
+       }
+
+       // get base capabilities
+       cap_base = cap_current;
+       baseOptions = CFDictionaryGetValue(baseSettings, interfaceName);
+       if (baseOptions != NULL) {
+               CFNumberRef     num;
+
+               num = CFDictionaryGetValue(baseOptions, CAPABILITIES_KEY);
+               if (num != NULL) {
+                       CFNumberGetValue(num, kCFNumberIntType, &cap_base);
+               }
+       }
+
+       cap_requested = __SCNetworkInterfaceCreateCapabilities(interface, cap_base, options);
+
+#ifdef SIOCSIFCAP
+       if (cap_requested == cap_current) {
+               /* if current setting is as requested */
+               return TRUE;
+       }
+
+       bzero((char *)&ifr, sizeof(ifr));
+       (void)_SC_cfstring_to_cstring(interfaceName, ifr.ifr_name, sizeof(ifr.ifr_name), kCFStringEncodingASCII);
+       ifr.ifr_curcap = cap_current;
+       ifr.ifr_reqcap = cap_requested;
+
+       sock = socket(AF_INET, SOCK_DGRAM, 0);
+       if (sock == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
+               return FALSE;
+       }
+
+       ret = ioctl(sock, SIOCSIFCAP, (caddr_t)&ifr);
+       (void)close(sock);
+       if (ret == -1) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("ioctl(SIOCSIFCAP) failed: %s"), strerror(errno));
+               return FALSE;
+       }
+#endif // SIOCSIFCAP
+
+       return TRUE;
+}
+
+
+#pragma mark -
+#pragma mark Media options
 
 
 static CFDictionaryRef
@@ -109,10 +188,16 @@ _SCNetworkInterfaceSetMediaOptions(SCNetworkInterfaceRef  interface,
        CFDictionaryRef         requested;
        int                     sock            = -1;
 
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
        interfaceName = SCNetworkInterfaceGetBSDName(interface);
        if (interfaceName == NULL) {
                /* if no BSD interface name */
                SCLog(_verbose, LOG_INFO, CFSTR("no BSD interface name for %@"), interface);
+               _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
 
@@ -153,7 +238,7 @@ _SCNetworkInterfaceSetMediaOptions(SCNetworkInterfaceRef    interface,
                goto done;
        }
 
-       newOptions = __createMediaOptions(interfaceName, requested);
+       newOptions = __SCNetworkInterfaceCreateMediaOptions(interface, requested);
        if (newOptions == -1) {
                /* since we have just validated, this should never happen */
                goto done;
@@ -199,6 +284,10 @@ _SCNetworkInterfaceSetMediaOptions(SCNetworkInterfaceRef   interface,
 }
 
 
+#pragma mark -
+#pragma mark MTU
+
+
 #ifndef        USE_SIOCSIFMTU
 static void
 ifconfig_exit(pid_t pid, int status, struct rusage *rusage, void *context)
@@ -336,6 +425,10 @@ _SCNetworkInterfaceSetMTU(SCNetworkInterfaceRef    interface,
 }
 
 
+#pragma mark -
+#pragma mark Update link configuration
+
+
 /*
  * Function: parse_component
  * Purpose:
@@ -427,6 +520,7 @@ updateLink(CFStringRef interfaceName, CFDictionaryRef options)
 
        if (options != NULL) {
                if (!CFDictionaryContainsKey(baseSettings, interfaceName)) {
+                       int                     cur_cap         = -1;
                        CFDictionaryRef         cur_media       = NULL;
                        CFMutableDictionaryRef  new_media       = NULL;
                        int                     cur_mtu         = -1;
@@ -457,6 +551,23 @@ updateLink(CFStringRef interfaceName, CFDictionaryRef options)
                                }
                        }
 
+                       /* preserve capabilities */
+                       cur_cap = __SCNetworkInterfaceCreateCapabilities(interface, -1, NULL);
+                       if (cur_cap != -1) {
+                               CFNumberRef     num;
+
+                               if (new_media == NULL) {
+                                       new_media = CFDictionaryCreateMutable(NULL,
+                                                                             0,
+                                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                                             &kCFTypeDictionaryValueCallBacks);
+                               }
+
+                               num = CFNumberCreate(NULL, kCFNumberIntType, &cur_cap);
+                               CFDictionaryAddValue(new_media, CAPABILITIES_KEY, num);
+                               CFRelease(num);
+                       }
+
                        if (new_media != NULL) {
                                CFDictionarySetValue(baseSettings, interfaceName, new_media);
                                CFRelease(new_media);
@@ -464,6 +575,7 @@ updateLink(CFStringRef interfaceName, CFDictionaryRef options)
                }
 
                /* establish new settings */
+               (void)_SCNetworkInterfaceSetCapabilities(interface, options);
                (void)_SCNetworkInterfaceSetMediaOptions(interface, options);
                (void)_SCNetworkInterfaceSetMTU         (interface, options);
        } else {
@@ -471,6 +583,7 @@ updateLink(CFStringRef interfaceName, CFDictionaryRef options)
                options = CFDictionaryGetValue(baseSettings, interfaceName);
                if (options != NULL) {
                        /* restore original settings */
+                       (void)_SCNetworkInterfaceSetCapabilities(interface, options);
                        (void)_SCNetworkInterfaceSetMediaOptions(interface, options);
                        (void)_SCNetworkInterfaceSetMTU         (interface, options);
                        CFDictionaryRemoveValue(baseSettings, interfaceName);
@@ -634,12 +747,81 @@ load_LinkConfiguration(CFBundleRef bundle, Boolean bundleVerbose)
 
 
 #ifdef MAIN
+
+
+#pragma mark -
+#pragma mark Standalone test code
+
+
 int
 main(int argc, char **argv)
 {
+       SCPreferencesRef        prefs;
+
        _sc_log     = FALSE;
        _sc_verbose = (argc > 1) ? TRUE : FALSE;
 
+       prefs = SCPreferencesCreate(NULL, CFSTR("linkconfig"), NULL);
+       if (prefs != NULL) {
+               SCNetworkSetRef set;
+
+               set = SCNetworkSetCopyCurrent(prefs);
+               if (set != NULL) {
+                       CFMutableSetRef seen;
+                       CFArrayRef      services;
+
+                       services = SCNetworkSetCopyServices(set);
+                       if (services != NULL) {
+                               CFIndex         i;
+                               CFIndex         n;
+
+                               seen = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+
+                               n = CFArrayGetCount(services);
+                               for (i = 0; i < n; i++) {
+                                       SCNetworkInterfaceRef   interface;
+                                       SCNetworkServiceRef     service;
+
+                                       service = CFArrayGetValueAtIndex(services, i);
+                                       interface = SCNetworkServiceGetInterface(service);
+                                       if ((interface != NULL) &&
+                                           !CFSetContainsValue(seen, interface)){
+                                               CFDictionaryRef capabilities;
+
+                                               capabilities = SCNetworkInterfaceCopyCapability(interface, NULL);
+                                               if (capabilities != NULL) {
+                                                       int             cap_current;
+                                                       int             cap_requested;
+                                                       CFDictionaryRef options;
+
+                                                       options = SCNetworkInterfaceGetConfiguration(interface);
+                                                       cap_current   = __SCNetworkInterfaceCreateCapabilities(interface, -1, NULL);
+                                                       cap_requested = __SCNetworkInterfaceCreateCapabilities(interface, cap_current, options);
+
+                                                       SCPrint(TRUE, stdout,
+                                                               CFSTR("%sinterface = %@, current = %p, requested = %p\n%@\n"),
+                                                               (i == 0) ? "" : "\n",
+                                                               SCNetworkInterfaceGetBSDName(interface),
+                                                               (void *)(uintptr_t)cap_current,
+                                                               (void *)(uintptr_t)cap_requested,
+                                                               capabilities);
+                                                       CFRelease(capabilities);
+                                               }
+
+                                               CFSetAddValue(seen, interface);
+                                       }
+                               }
+
+                               CFRelease(seen);
+                               CFRelease(services);
+                       }
+
+                       CFRelease(set);
+               }
+
+               CFRelease(prefs);
+       }
+
        load_LinkConfiguration(CFBundleGetMainBundle(), (argc > 1) ? TRUE : FALSE);
        CFRunLoopRun();
        /* not reached */
index d4602826be313575581f3b4694de651803a26c33..42509e52a699df94dad96c20a6ccb4cc33c45189 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
        <key>Enabled</key>
-       <true/>
+       <false/>
        <key>Verbose</key>
        <false/>
        <key>LOG_ALL</key>
index 6d96c4911f1ccb8d0a8bccbc29c07850424584b9..a5ca3f62e0cb661ab32ba1b1da58b2d6e25596e7 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
        <key>Enabled</key>
        <false/>
        <key>Verbose</key>
index 1fa00706f35c9a94177d3d2294dc3760a20f1644..6e67879cc4d20f2a3c611e9aebe211d6079857a1 100644 (file)
@@ -1,5 +1,5 @@
 logger: logger.c
-       cc -Wall -g -DMAIN -o logger logger.c -framework CoreFoundation -framework SystemConfiguration -framework IOKit -ldnsinfo
+       cc -Wall -g -DMAIN -o logger logger.c -framework CoreFoundation -framework SystemConfiguration -framework IOKit
 
 clean:
        rm -rf logger logger.dSYM
index 3abe51d07ac8f1ca4d1391b58849ff790e650bb1..489734c7d025ef48e6f24f33bc216de7bc00e58a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <IOKit/IOMessage.h>
 #include <IOKit/pwr_mgt/IOPM.h>
 #include <IOKit/pwr_mgt/IOPMLib.h>
+#include <IOKit/pwr_mgt/IOPMLibPrivate.h>
 
 #include <dnsinfo.h>
 #include <notify.h>
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) && !TARGET_OS_EMBEDDED
 #include <utmpx.h>
+#include <utmpx_thread.h>
+#endif // !(__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) && !TARGET_OS_EMBEDDED
 
 
 /* generic MessageTracer keys */
@@ -133,7 +137,7 @@ copyInterfaceFlags(const char *if_name)
        }
 
        bzero((char *)&ifr, sizeof(ifr));
-       (void) strncpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name));
+       (void) strlcpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name));
        if (ioctl(sock, SIOCGIFFLAGS, (caddr_t)&ifr) == 0) {
                struct ifmediareq       ifm;
 
@@ -233,11 +237,10 @@ KernelEvent_notification(CFSocketRef s, CFSocketCallBackType type, CFDataRef add
                                                switch (ev_msg->kev_subclass) {
                                                        case KEV_DL_SUBCLASS : {
                                                                struct net_event_data   *ev;
-                                                               char                    if_name[IFNAMSIZ+1];
+                                                               char                    if_name[IFNAMSIZ];
 
                                                                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);
@@ -296,12 +299,11 @@ KernelEvent_notification(CFSocketRef s, CFSocketCallBackType type, CFDataRef add
                                                        case KEV_INET_SUBCLASS : {
                                                                char                    addr[128];
                                                                struct kev_in_data      *ev;
-                                                               char                    if_name[IFNAMSIZ+1];
+                                                               char                    if_name[IFNAMSIZ];
                                                                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);
@@ -365,12 +367,11 @@ KernelEvent_notification(CFSocketRef s, CFSocketCallBackType type, CFDataRef add
                                                        case KEV_INET6_SUBCLASS : {
                                                                char                    addr[128];
                                                                struct kev_in6_data     *ev;
-                                                               char                    if_name[IFNAMSIZ+1];
+                                                               char                    if_name[IFNAMSIZ];
                                                                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);
@@ -459,9 +460,9 @@ add_KernelEvent_notification()
        }
 
        /* 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 */
+       kev_req.vendor_code  = KEV_VENDOR_APPLE;
+       kev_req.kev_class    = KEV_NETWORK_CLASS;
+       kev_req.kev_subclass = KEV_ANY_SUBCLASS;
        if (ioctl(so, SIOCSKEVFILT, &kev_req) == -1) {
                SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("ioctl(, SIOCSKEVFILT, ) failed"));
                (void)close(so);
@@ -718,7 +719,8 @@ NetworkChange_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void
                        }
                        CFStringAppendFormat(str, NULL, CFSTR("\n%@ (%s)"), key, val);
                } else if (CFStringHasSuffix(key, kSCEntNetIPv4) ||
-                          CFStringHasSuffix(key, kSCEntNetIPv6)) {
+                          CFStringHasSuffix(key, kSCEntNetIPv6) ||
+                          CFStringHasSuffix(key, kSCEntNetDNS)) {
                        CFDictionaryRef dict;
 
                        dict = SCDynamicStoreCopyValue(store, key);
@@ -732,6 +734,20 @@ NetworkChange_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void
                        } else {
                                CFStringAppendFormat(str, NULL, CFSTR("\n%@ : removed"), key);
                        }
+               } else if (CFStringHasSuffix(key, CFSTR(kIOPMSystemPowerCapabilitiesKeySuffix))) {
+                       CFNumberRef     num;
+
+                       num = SCDynamicStoreCopyValue(store, key);
+                       if (num != NULL) {
+                               IOPMSystemPowerStateCapabilities        capabilities;
+
+                               if (isA_CFNumber(num) &&
+                                   CFNumberGetValue(num, kCFNumberSInt32Type, &capabilities)) {
+                                       CFStringAppendFormat(str, NULL, CFSTR("\n%@ (0x%x)"), key, capabilities);
+                               }
+
+                               CFRelease(num);
+                       }
                } else {
                        CFStringAppendFormat(str, NULL, CFSTR("\n%@"), key);
                }
@@ -798,6 +814,24 @@ add_NetworkChange_notification()
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
 
+       // PPP, VPN
+
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetPPP);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetPPP);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetVPN);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetVPN);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
        // Link
 
        pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetLink);
@@ -840,6 +874,12 @@ add_NetworkChange_notification()
        CFArrayAppendValue(keys, key);
        CFRelease(key);
 
+       key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@%@"),
+                                     kSCDynamicStoreDomainState,
+                                     CFSTR(kIOPMSystemPowerCapabilitiesKeySuffix));
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
        ok = SCDynamicStoreSetNotificationKeys(store, keys, patterns);
        CFRelease(keys);
        CFRelease(patterns);
@@ -1270,7 +1310,7 @@ add_dnsinfo_notification()
                return;
        }
 
-       mp = CFMachPortCreateWithPort(NULL, notify_port, dnsinfo_notification, NULL, NULL);
+       mp = _SC_CFMachPortCreateWithPort("Logger/dns_configuration", notify_port, dnsinfo_notification, NULL);
        if (mp == NULL) {
                SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed"));
                (void)notify_cancel(notify_token);
@@ -1327,7 +1367,7 @@ add_network_notification()
                return;
        }
 
-       mp = CFMachPortCreateWithPort(NULL, notify_port, network_notification, NULL, NULL);
+       mp = _SC_CFMachPortCreateWithPort("Logger/network_change", notify_port, network_notification, NULL);
        if (mp == NULL) {
                SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed"));
                (void)notify_cancel(notify_token);
@@ -1386,7 +1426,7 @@ add_smbconf_notification()
                return;
        }
 
-       mp = CFMachPortCreateWithPort(NULL, notify_port, smbconf_notification, NULL, NULL);
+       mp = _SC_CFMachPortCreateWithPort("Logger/smb_configuration", notify_port, smbconf_notification, NULL);
        if (mp == NULL) {
                SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed"));
                (void)notify_cancel(notify_token);
@@ -1413,7 +1453,7 @@ add_smbconf_notification()
 #pragma mark pututxline Events
 
 
-#if    !TARGET_OS_EMBEDDED
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) && !TARGET_OS_EMBEDDED
 static const char *
 ut_time(struct utmpx *utmpx)
 {
@@ -1470,14 +1510,15 @@ pututxline_notification(CFMachPortRef port, void *msg, CFIndex size, void *info)
 {
        CFMutableStringRef      str     = CFStringCreateMutable(NULL, 0);
        struct utmpx            *utmpx;
+       utmpx_t                 utx;
 
        CFStringAppendFormat(str,
                             NULL,
                             CFSTR("%s pututxline notification"),
                             elapsed());
 
-       setutxent();
-       while ((utmpx = getutxent()) != NULL) {
+       utx = _openutx(NULL);
+       while ((utmpx = _getutxent(utx)) != NULL) {
                const char *    entry_id        = NULL;
                const char *    entry_line      = NULL;
                const char *    entry_pid       = NULL;
@@ -1565,7 +1606,7 @@ pututxline_notification(CFMachPortRef port, void *msg, CFIndex size, void *info)
 
                CFStringAppendFormat(str, NULL, CFSTR("%s"), line);
        }
-       endutxent();
+       _endutxent(utx);
 
        SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str);
        CFRelease(str);
@@ -1588,7 +1629,7 @@ add_pututxline_notification()
                return;
        }
 
-       mp = CFMachPortCreateWithPort(NULL, notify_port, pututxline_notification, NULL, NULL);
+       mp = _SC_CFMachPortCreateWithPort("Logger/utmpx", notify_port, pututxline_notification, NULL);
        if (mp == NULL) {
                SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed"));
                (void)notify_cancel(notify_token);
@@ -1608,7 +1649,7 @@ add_pututxline_notification()
        CFRelease(mp);
        return;
 }
-#endif // !TARGET_OS_EMBEDDED
+#endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) && !TARGET_OS_EMBEDDED
 
 
 #pragma mark -
@@ -1704,7 +1745,7 @@ add_BTMM_notification()
 #pragma mark -
 
 
-static inline Boolean
+static __inline__ Boolean
 bValFromDictionary(CFDictionaryRef dict, CFStringRef key)
 {
        CFBooleanRef    bVal;
@@ -1765,11 +1806,11 @@ load(CFBundleRef bundle, Boolean bundleVerbose)
        }
 #endif // !TARGET_OS_EMBEDDED
 
-#if    !TARGET_OS_EMBEDDED
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) && !TARGET_OS_EMBEDDED
        if (log_all || bValFromDictionary(config, CFSTR("LOG_NOTIFY_UTMPX_CHANGE"))) {
                add_pututxline_notification();
        }
-#endif // !TARGET_OS_EMBEDDED
+#endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) && !TARGET_OS_EMBEDDED
 
 #if    !TARGET_OS_EMBEDDED
        if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_BTMM_CONFIGURATION"))) {
@@ -1807,6 +1848,10 @@ load(CFBundleRef bundle, Boolean bundleVerbose)
                        hosts = NULL;
                }
 
+               if (verbose) {
+                       _sc_debug = TRUE;
+               }
+
                add_reachability_notification(hosts);
        }
 
index d5421f89b55cbfbb501080c581cd1c1e178a52a1..f3aa4210c9645add630ccc1fd10f486546717529 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
        <key>Builtin</key>
        <true/>
 </dict>
index af8557a38b515052dd8d4e06eab98ee158eed9e8..d202828d1b329104997055ddbef1e754369ea0bf 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
        <key>Builtin</key>
        <true/>
        <key>Requires</key>
index 637f82782ad6ca86e6e80af2f6c136bdf5dcf06f..bd496eb6c8dbde33dd44a86ca35df2d53155f7ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -63,6 +63,7 @@ static CFMutableDictionaryRef newPrefs;               /* new prefs */
 static CFMutableArrayRef       unchangedPrefsKeys;     /* new prefs keys which match current */
 static CFMutableArrayRef       removedPrefsKeys;       /* old prefs keys to be removed */
 
+static Boolean                 rofs            = FALSE;
 static Boolean                 _verbose        = FALSE;
 
 
@@ -146,6 +147,9 @@ establishNewPreferences()
                        if (sc_status == EROFS) {
                                /* a read-only fileysstem is OK */
                                ok = TRUE;
+
+                               /* ... but we don't want to synchronize */
+                               rofs = TRUE;
                        }
                }
 
@@ -199,7 +203,7 @@ quiet(Boolean *timeout)
 static void
 watchQuietDisable()
 {
-       if ((initKey == NULL) && (initRls == NULL)) {
+       if ((initKey == NULL) || (initRls == NULL)) {
                return;
        }
 
@@ -612,7 +616,9 @@ updateConfiguration(SCPreferencesRef                prefs,
        updateSCDynamicStore(prefs);
 
        /* finished with current prefs, wait for changes */
-       SCPreferencesSynchronize(prefs);
+       if (!rofs) {
+               SCPreferencesSynchronize(prefs);
+       }
 
        return;
 }
index 094b9d1c50066da8bfe03fa8d49884180687e097..0f5dca288bc2a1e7c315eab57951795f78b3e902 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
        <key>CFPlugInDynamicRegistration</key>
        <string>NO</string>
        <key>CFPlugInFactories</key>
index 17b347d757cbca92ad802a61db7fb6a3a9b5a1f8..a7d3fefe101eed21187f4f6ea56157d1dd4770a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -75,6 +75,8 @@ typedef struct {
        CFUUIDRef                       _factoryID;
        UInt32                          _refCount;
 
+       Boolean                         debug;
+
        aslmsg                          log_msg;
 
        CFStringRef                     configuration_action;
@@ -96,11 +98,85 @@ typedef struct {
 
        CFUserNotificationRef           userNotification;
        CFRunLoopSourceRef              userRls;
+
+       AuthorizationRef                authorization;
 } MyType;
 
 static CFMutableDictionaryRef  notify_to_instance      = NULL;
 
 
+#pragma mark -
+#pragma mark Authorization
+
+
+static AuthorizationRef
+getAuthorization(MyType *myInstance)
+{
+       if (myInstance->authorization == NULL) {
+               AuthorizationFlags      flags   = kAuthorizationFlagDefaults;
+               OSStatus                status;
+
+               status = AuthorizationCreate(NULL,
+                                            kAuthorizationEmptyEnvironment,
+                                            flags,
+                                            &myInstance->authorization);
+               if (status != errAuthorizationSuccess) {
+                       SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR,
+                             CFSTR("AuthorizationCreate() failed: status = %d"),
+                             status);
+               }
+       }
+
+       return myInstance->authorization;
+}
+
+
+static Boolean
+hasAuthorization(MyType *myInstance)
+{
+       AuthorizationRef        authorization;
+       Boolean                 isAdmin         = FALSE;
+
+       authorization = getAuthorization(myInstance);
+       if (authorization != NULL) {
+               AuthorizationFlags      flags   = kAuthorizationFlagDefaults;
+               AuthorizationItem       items[1];
+               AuthorizationRights     rights;
+               OSStatus                status;
+
+               items[0].name        = "system.preferences";
+               items[0].value       = NULL;
+               items[0].valueLength = 0;
+               items[0].flags       = 0;
+
+               rights.count = sizeof(items) / sizeof(items[0]);
+               rights.items = items;
+
+               status = AuthorizationCopyRights(authorization,
+                                                &rights,
+                                                kAuthorizationEmptyEnvironment,
+                                                flags,
+                                                NULL);
+               isAdmin = (status == errAuthorizationSuccess);
+       }
+
+       return isAdmin;
+}
+
+
+static void
+freeAuthorization(MyType *myInstance)
+{
+       if (myInstance->authorization != NULL) {
+               AuthorizationFree(myInstance->authorization, kAuthorizationFlagDefaults);
+//              AuthorizationFree(myInstance->authorization, kAuthorizationFlagDestroyRights);
+               myInstance->authorization = NULL;
+       }
+
+       return;
+}
+
+
 #pragma mark -
 #pragma mark New interface notification / configuration
 
@@ -377,7 +453,6 @@ notify_add(MyType *myInstance)
 static void
 notify_configure(MyType *myInstance)
 {
-       AuthorizationRef        authorization   = NULL;
        CFIndex                 i;
        CFIndex                 n               = CFArrayGetCount(myInstance->interfaces_configure);
        Boolean                 ok;
@@ -387,17 +462,10 @@ notify_configure(MyType *myInstance)
        if (geteuid() == 0) {
                prefs = SCPreferencesCreate(NULL, CFSTR("SCMonitor"), NULL);
        } else {
-               AuthorizationFlags      flags           = kAuthorizationFlagDefaults;
-               OSStatus                status;
+               AuthorizationRef        authorization;
 
-               status = AuthorizationCreate(NULL,
-                                            kAuthorizationEmptyEnvironment,
-                                            flags,
-                                            &authorization);
-               if (status != errAuthorizationSuccess) {
-                       SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR,
-                             CFSTR("AuthorizationCreate() failed: status = %d"),
-                             status);
+               authorization = getAuthorization(myInstance);
+               if (authorization == NULL) {
                        return;
                }
 
@@ -453,12 +521,6 @@ notify_configure(MyType *myInstance)
                prefs = NULL;
        }
 
-       if (authorization != NULL) {
-               AuthorizationFree(authorization, kAuthorizationFlagDefaults);
-//              AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
-               authorization = NULL;
-       }
-
        CFRelease(myInstance->interfaces_configure);
        myInstance->interfaces_configure = NULL;
 
@@ -495,7 +557,7 @@ updateInterfaceList(MyType *myInstance)
 
        interfaces_old = CFSetCreateMutableCopy(NULL, 0, myInstance->interfaces_known);
 
-       interfaces = SCNetworkInterfaceCopyAll();
+       interfaces = _SCNetworkInterfaceCopyAllWithPreferences(prefs);
        if (interfaces != NULL) {
                n = CFArrayGetCount(interfaces);
                for (i = 0; i < n; i++) {
@@ -543,6 +605,12 @@ updateInterfaceList(MyType *myInstance)
                                                myInstance->interfaces_configure = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
                                        }
                                        CFArrayAppendValue(myInstance->interfaces_configure, interface);
+                               } else if (hasAuthorization(myInstance)) {
+                                       // if we already have the "admin" (system.preferences) right, 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) {
@@ -841,14 +909,14 @@ add_init_watcher(MyType *myInstance, io_registry_entry_t interface)
        while (node != MACH_PORT_NULL) {
                io_registry_entry_t     parent;
 
-               val = IORegistryEntryCreateCFProperty(node, CFSTR("HiddenPort"), NULL, 0);
+               val = IORegistryEntryCreateCFProperty(node, kSCNetworkInterfaceHiddenPortKey, NULL, 0);
                if (val != NULL) {
                        CFRelease(val);
                        val = NULL;
                        break;
                }
 
-               val = IORegistryEntryCreateCFProperty(node, CFSTR("Initializing"), NULL, 0);
+               val = IORegistryEntryCreateCFProperty(node, kSCNetworkInterfaceInitializingKey, NULL, 0);
                if (val != NULL) {
                        break;
                }
@@ -1007,12 +1075,19 @@ watcher_add(MyType *myInstance)
        bundle = CFBundleGetBundleWithIdentifier(CFSTR(MY_BUNDLE_ID));
        if (bundle != NULL) {
                CFStringRef     action;
+               CFBooleanRef    bVal;
                CFDictionaryRef info;
 
                info = CFBundleGetInfoDictionary(bundle);
+
+               bVal = CFDictionaryGetValue(info, CFSTR("Debug"));
+               bVal = isA_CFBoolean(bVal);
+               if (bVal != NULL) {
+                       myInstance->debug = CFBooleanGetValue(bVal);
+               }
+
                action = CFDictionaryGetValue(info, kSCNetworkInterfaceConfigurationActionKey);
                action = isA_CFString(action);
-
                if (action != NULL) {
                        myInstance->configuration_action = action;
                } else {
@@ -1095,6 +1170,7 @@ myRelease(void *myInstance)
 
                        watcher_remove((MyType *)myInstance);
                        notify_remove((MyType *)myInstance, TRUE);
+                       freeAuthorization((MyType *)myInstance);
                }
                free(myInstance);
                return 0;
diff --git a/SystemConfiguration.fproj/AppWorkaround.plist b/SystemConfiguration.fproj/AppWorkaround.plist
new file mode 100644 (file)
index 0000000..e4c1550
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>kCSCheckFixVersion</key>
+       <string>1</string>
+       <key>kCSCheckFixUniversal</key>
+       <dict>
+               <key>7408115</key>
+               <dict>
+                       <key>com.mackiev.3dweatherglobe</key>
+                       <array>
+                               <string>231</string>
+                               <string>232</string>
+                       </array>
+               </dict>
+               <key>9022571</key>
+               <dict>
+                       <key>com.mackiev.3dweatherglobe</key>
+                       <array>
+                               <string>256</string>
+                       </array>
+               </dict>
+       </dict>
+</dict>
+</plist>
index 7746e7a0dc6b2cc5804fc41c14681236f1e2d44d..4b4891084d6d00287849f263a3dea8f49cfdd3bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -100,7 +100,7 @@ if_bond_status_req_copy(int s, const char * ifname)
        struct ifreq                    ifr;
 
        bzero(&ifr, sizeof(ifr));
-       strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+       strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
        bzero((char *)&ibr, sizeof(ibr));
        ibr.ibr_op = IF_BOND_OP_GET_STATUS;
        ibsr_p = &ibr.ibr_ibru.ibru_status;
@@ -393,7 +393,7 @@ SCBondInterfaceCopyAll(SCPreferencesRef prefs)
 
 
 __private_extern__ void
-__SCBondInterfaceListCopyMembers(CFArrayRef interfaces, CFMutableSetRef set)
+__SCBondInterfaceListCollectMembers(CFArrayRef interfaces, CFMutableSetRef set)
 {
        CFIndex i;
        CFIndex n;
@@ -428,16 +428,23 @@ CFArrayRef /* of SCNetworkInterfaceRef's */
 SCBondInterfaceCopyAvailableMemberInterfaces(SCPreferencesRef prefs)
 {
        CFMutableArrayRef       available;
-       CFMutableSetRef         exclude;
+       CFMutableSetRef         excluded;
        CFArrayRef              interfaces;
 
        available = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-       exclude   = CFSetCreateMutable  (NULL, 0, &kCFTypeSetCallBacks);
+       excluded  = CFSetCreateMutable  (NULL, 0, &kCFTypeSetCallBacks);
 
        // exclude Bond [member] interfaces
        interfaces = SCBondInterfaceCopyAll(prefs);
        if (interfaces != NULL) {
-               __SCBondInterfaceListCopyMembers(interfaces, exclude);
+               __SCBondInterfaceListCollectMembers(interfaces, excluded);
+               CFRelease(interfaces);
+       }
+
+       // exclude Bridge [member] interfaces
+       interfaces = SCBridgeInterfaceCopyAll(prefs);
+       if (interfaces != NULL) {
+               __SCBridgeInterfaceListCollectMembers(interfaces, excluded);
                CFRelease(interfaces);
        }
 
@@ -455,7 +462,7 @@ SCBondInterfaceCopyAvailableMemberInterfaces(SCPreferencesRef prefs)
                        // exclude the physical interface of this VLAN
                        vlanInterface = CFArrayGetValueAtIndex(interfaces, i);
                        physical = SCVLANInterfaceGetPhysicalInterface(vlanInterface);
-                       CFSetAddValue(exclude, physical);
+                       CFSetAddValue(excluded, physical);
                }
                CFRelease(interfaces);
        }
@@ -479,7 +486,7 @@ SCBondInterfaceCopyAvailableMemberInterfaces(SCPreferencesRef prefs)
                                continue;
                        }
 
-                       if (CFSetContainsValue(exclude, interface)) {
+                       if (CFSetContainsValue(excluded, interface)) {
                                // if excluded
                                continue;
                        }
@@ -489,7 +496,7 @@ SCBondInterfaceCopyAvailableMemberInterfaces(SCPreferencesRef prefs)
                CFRelease(interfaces);
        }
 
-       CFRelease(exclude);
+       CFRelease(excluded);
 
        return available;
 }
@@ -567,12 +574,9 @@ _SCBondInterfaceCopyActive(void)
                        // iterate over each member interface
                        ibs_p = (struct if_bond_status *)ibsr_p->ibsr_buffer;
                        for (i = 0; i < ibsr_p->ibsr_total; i++) {
-                               char            if_name[IFNAMSIZ + 1];
                                CFStringRef     member;
 
-                               bzero(&if_name, sizeof(if_name));
-                               bcopy(ibs_p[i].ibs_if_name, if_name, IFNAMSIZ);
-                               member = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingASCII);
+                               member = CFStringCreateWithCString(NULL, ibs_p[i].ibs_if_name, kCFStringEncodingASCII);
                                add_interface(&members, member);
                                CFRelease(member);
                        }
@@ -802,7 +806,8 @@ Boolean
 SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members)
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
-       Boolean                         ok                      = TRUE;
+       Boolean                         ok;
+       int                             sc_status               = kSCStatusOK;
 
        if (!isA_SCBondInterface(bond)) {
                _SCErrorSet(kSCStatusInvalidArgument);
@@ -821,6 +826,7 @@ SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members)
                CFIndex         n_available;
                CFIndex         n_current;
                CFIndex         n_members;
+               CFArrayRef      services        = NULL;
 
                current     = SCBondInterfaceGetMemberInterfaces(bond);
                n_current   = (current != NULL) ? CFArrayGetCount(current) : 0;
@@ -842,26 +848,37 @@ SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members)
 
                        if ((available != NULL) &&
                            CFArrayContainsValue(available, CFRangeMake(0, n_available), member)) {
-                               // available members are allowed
+                               // available members are allowed but cannot be associated
+                               // with any other network services.
+
+                               if (services == NULL) {
+                                       services = __SCNetworkServiceCopyAllEnabled(interfacePrivate->prefs);
+                               }
+                               if ((services != NULL) &&
+                                   __SCNetworkServiceExistsForInterface(services, member)) {
+                                       sc_status = kSCStatusKeyExists;
+                                       break;
+                               }
+
+                               // if available
                                continue;
                        }
 
                        // if member not allowed
-                       ok = FALSE;
+                       sc_status = kSCStatusInvalidArgument;
                        break;
                }
 
-               CFRelease(available);
-
-               if (!ok) {
-                       _SCErrorSet(kSCStatusInvalidArgument);
-               }
+               if (available != NULL) CFRelease(available);
+               if (services != NULL) CFRelease(services);
        }
 
-       if (ok) {
-               ok = _SCBondInterfaceSetMemberInterfaces(bond, members);
+       if (sc_status != kSCStatusOK) {
+               _SCErrorSet(sc_status);
+               return FALSE;
        }
 
+       ok = _SCBondInterfaceSetMemberInterfaces(bond, members);
        return ok;
 }
 
@@ -1308,7 +1325,7 @@ SCBondInterfaceCopyStatus(SCBondInterfaceRef bond)
        int                             bond_if_status;
        CFIndex                         i;
        struct if_bond_status_req       *ibsr_p         = NULL;
-       char                            if_name[IFNAMSIZ + 1];
+       char                            if_name[IFNAMSIZ];
        CFIndex                         n;
        CFNumberRef                     num;
        int                             s;
@@ -1426,8 +1443,7 @@ SCBondInterfaceCopyStatus(SCBondInterfaceRef bond)
                }
 
                // interface
-               bzero(&if_name, sizeof(if_name));
-               bcopy(scan_p->ibs_if_name, if_name, IFNAMSIZ);
+               strlcpy(if_name, scan_p->ibs_if_name, sizeof(if_name));
                interface_name = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingASCII);
                interface = _SCNetworkInterfaceCreateWithBSDName(NULL, interface_name,
                                                                 kIncludeNoVirtualInterfaces);
@@ -1600,11 +1616,11 @@ _SCBondInterfaceUpdateConfiguration(SCPreferencesRef prefs)
 
        /* configured Bonds */
        config  = SCBondInterfaceCopyAll(prefs);
-       nConfig = CFArrayGetCount(config);
+       nConfig = (config != NULL) ? CFArrayGetCount(config) : 0;
 
        /* active Bonds */
        active  = _SCBondInterfaceCopyActive();
-       nActive = CFArrayGetCount(active);
+       nActive = (active != NULL) ? CFArrayGetCount(active) : 0;
 
        /*
         * remove any no-longer-configured bond interfaces and
@@ -1710,7 +1726,7 @@ _SCBondInterfaceUpdateConfiguration(SCPreferencesRef prefs)
                c_bond            = CFArrayGetValueAtIndex(config, i);
                c_bond_if         = SCNetworkInterfaceGetBSDName(c_bond);
                c_bond_interfaces = SCBondInterfaceGetMemberInterfaces(c_bond);
-               c_bond_mode               = SCBondInterfaceGetMode(c_bond);
+               c_bond_mode       = SCBondInterfaceGetMode(c_bond);
                c_count           = (c_bond_interfaces != NULL) ? CFArrayGetCount(c_bond_interfaces) : 0;
 
                for (j = 0; j < nActive; j++) {
diff --git a/SystemConfiguration.fproj/BridgeConfiguration.c b/SystemConfiguration.fproj/BridgeConfiguration.c
new file mode 100644 (file)
index 0000000..806856c
--- /dev/null
@@ -0,0 +1,1221 @@
+/*
+ * Copyright (c) 2009-2011 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
+ *
+ * July 27, 2009               Allan Nathanson <ajn@apple.com>
+ * - initial revision
+ */
+
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreFoundation/CFRuntime.h>
+
+#include <SystemConfiguration/SystemConfiguration.h>
+#include "SCNetworkConfigurationInternal.h"
+#include <SystemConfiguration/SCValidation.h>
+#include <SystemConfiguration/SCPrivate.h>
+
+#include <ifaddrs.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <net/ethernet.h>
+#define        KERNEL_PRIVATE
+#include <net/if.h>
+#include <net/if_var.h>
+#undef KERNEL_PRIVATE
+#include <net/if_types.h>
+#include <net/if_media.h>
+#include <net/route.h>
+
+#ifdef IFT_BRIDGE
+#include <net/if_bridgevar.h>
+#endif // IFT_BRIDGE
+
+/* ---------- Bridge support ---------- */
+
+static int
+inet_dgram_socket()
+{
+       int     s;
+
+       s = socket(AF_INET, SOCK_DGRAM, 0);
+       if (s == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
+       }
+
+       return s;
+}
+
+#ifdef IFT_BRIDGE
+static struct ifbifconf *
+ifbifconf_copy(int s, const char * ifname)
+{
+       void *                  buf;
+       size_t                  buflen;
+       struct ifbifconf *      ibc_p   = NULL;
+       struct ifdrv            ifd;
+       uint32_t                len     = sizeof(struct ifbreq) * 16;
+
+       bzero(&ifd, sizeof(ifd));
+       strncpy(ifd.ifd_name, ifname, sizeof(ifd.ifd_name));
+       ifd.ifd_cmd = BRDGGIFS;
+
+       buflen = sizeof(struct ifbifconf) + len;
+       buf = malloc(buflen);
+       while (buf != NULL) {
+               bzero(buf, buflen);
+               ibc_p = (struct ifbifconf *)buf;
+               ibc_p->ifbic_len = len;
+               ibc_p->ifbic_buf = buf + sizeof(*ibc_p);
+
+               ifd.ifd_len = sizeof(*ibc_p);
+               ifd.ifd_data = ibc_p;
+               if (ioctl(s, SIOCGDRVSPEC, (caddr_t)&ifd) == -1) {
+                       goto failed;
+               }
+
+               if ((ibc_p->ifbic_len + sizeof(struct ifbreq)) < len) {
+                       // if we have room for all of the member interfaces
+                       break;
+               }
+
+               len *= 2;
+               buflen = sizeof(struct ifbifconf) + len;
+               buf = reallocf(buf, buflen);
+       }
+
+       if (buf == NULL) {
+               goto failed;
+       }
+
+       return ibc_p;
+
+    failed:
+       if (buf != NULL) {
+               free(buf);
+       }
+       return NULL;
+}
+#endif // IFT_BRIDGE
+
+
+static void
+add_interface(CFMutableArrayRef *interfaces, CFStringRef if_name)
+{
+       SCNetworkInterfaceRef   interface;
+
+       if (*interfaces == NULL) {
+               *interfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       }
+
+       interface = _SCNetworkInterfaceCreateWithBSDName(NULL, if_name,
+                                                        kIncludeNoVirtualInterfaces);
+       CFArrayAppendValue(*interfaces, interface);
+       CFRelease(interface);
+}
+
+
+static Boolean
+_SCBridgeInterfaceSetMemberInterfaces(SCBridgeInterfaceRef bridge, CFArrayRef members);
+
+
+typedef struct {
+       CFMutableArrayRef       bridges;
+       SCPreferencesRef        prefs;
+} addContext, *addContextRef;
+
+
+static void
+add_configured_interface(const void *key, const void *value, void *context)
+{
+       SCBridgeInterfaceRef            bridge;
+       CFStringRef                     bridge_if               = (CFStringRef)key;
+       CFDictionaryRef                 bridge_info     = (CFDictionaryRef)value;
+       CFDictionaryRef                 bridge_options;
+       CFIndex                         i;
+       CFArrayRef                      interfaces;
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+       CFMutableArrayRef               members         = NULL;
+       addContextRef                   myContext       = (addContextRef)context;
+       CFStringRef                     name;
+       CFIndex                         n;
+
+       // create the bridge interface
+       bridge = (SCBridgeInterfaceRef)_SCBridgeInterfaceCreatePrivate(NULL, bridge_if);
+
+       // add member interfaces
+       interfaces = CFDictionaryGetValue(bridge_info, kSCPropVirtualNetworkInterfacesBridgeInterfaces);
+       n = isA_CFArray(interfaces) ? CFArrayGetCount(interfaces) : 0;
+       for (i = 0; i < n; i++) {
+               CFStringRef     member;
+
+               member = CFArrayGetValueAtIndex(interfaces, i);
+               if (isA_CFString(member)) {
+                       add_interface(&members, member);
+               }
+       }
+       if (members != NULL) {
+               _SCBridgeInterfaceSetMemberInterfaces(bridge, members);
+               CFRelease(members);
+       }
+
+       // set display name
+       name = CFDictionaryGetValue(bridge_info, kSCPropUserDefinedName);
+       if (isA_CFString(name)) {
+               SCBridgeInterfaceSetLocalizedDisplayName(bridge, name);
+       }
+
+       // set options
+       bridge_options = CFDictionaryGetValue(bridge_info, kSCPropVirtualNetworkInterfacesBridgeOptions);
+       if (isA_CFDictionary(bridge_options)) {
+               SCBridgeInterfaceSetOptions(bridge, bridge_options);
+       }
+
+       // estabish link to the stored configuration
+       interfacePrivate = (SCNetworkInterfacePrivateRef)bridge;
+       interfacePrivate->prefs = CFRetain(myContext->prefs);
+
+       CFArrayAppendValue(myContext->bridges, bridge);
+       CFRelease(bridge);
+
+       return;
+}
+
+
+#pragma mark -
+#pragma mark SCBridgeInterface APIs
+
+
+CFArrayRef
+SCBridgeInterfaceCopyAll(SCPreferencesRef prefs)
+{
+       addContext              context;
+       CFDictionaryRef         dict;
+       CFStringRef             path;
+
+       context.bridges = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       context.prefs = prefs;
+
+       path = CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("/%@/%@"),
+                                       kSCPrefVirtualNetworkInterfaces,
+                                       kSCNetworkInterfaceTypeBridge);
+       dict = SCPreferencesPathGetValue(prefs, path);
+       if (isA_CFDictionary(dict)) {
+               CFDictionaryApplyFunction(dict, add_configured_interface, &context);
+       }
+       CFRelease(path);
+
+       return context.bridges;
+}
+
+
+__private_extern__ void
+__SCBridgeInterfaceListCollectMembers(CFArrayRef interfaces, CFMutableSetRef set)
+{
+       CFIndex i;
+       CFIndex n;
+
+       n = CFArrayGetCount(interfaces);
+       for (i = 0; i < n; i++) {
+               SCBridgeInterfaceRef    bridgeInterface;
+               CFArrayRef              members;
+
+               bridgeInterface = CFArrayGetValueAtIndex(interfaces, i);
+               members = SCBridgeInterfaceGetMemberInterfaces(bridgeInterface);
+               if (members != NULL) {
+                       CFIndex j;
+                       CFIndex n_members;
+
+                       // exclude the member interfaces of this bridge
+                       n_members = CFArrayGetCount(members);
+                       for (j = 0; j < n_members; j++) {
+                               SCNetworkInterfaceRef   member;
+
+                               member = CFArrayGetValueAtIndex(members, j);
+                               CFSetAddValue(set, member);
+                       }
+               }
+
+       }
+       return;
+}
+
+
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCBridgeInterfaceCopyAvailableMemberInterfaces(SCPreferencesRef prefs)
+{
+       CFMutableArrayRef       available;
+       CFMutableSetRef         excluded;
+       CFArrayRef              interfaces;
+
+       available = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       excluded  = CFSetCreateMutable  (NULL, 0, &kCFTypeSetCallBacks);
+
+       // exclude Bond [member] interfaces
+       interfaces = SCBondInterfaceCopyAll(prefs);
+       if (interfaces != NULL) {
+               __SCBondInterfaceListCollectMembers(interfaces, excluded);
+               CFRelease(interfaces);
+       }
+
+       // exclude Bridge [member] interfaces
+       interfaces = SCBridgeInterfaceCopyAll(prefs);
+       if (interfaces != NULL) {
+               __SCBridgeInterfaceListCollectMembers(interfaces, excluded);
+               CFRelease(interfaces);
+       }
+
+       // exclude VLAN [physical] interfaces
+       interfaces = SCVLANInterfaceCopyAll(prefs);
+       if (interfaces != NULL) {
+               CFIndex i;
+               CFIndex n;
+
+               n = CFArrayGetCount(interfaces);
+               for (i = 0; i < n; i++) {
+                       SCVLANInterfaceRef      vlanInterface;
+                       SCNetworkInterfaceRef   physical;
+
+                       // exclude the physical interface of this VLAN
+                       vlanInterface = CFArrayGetValueAtIndex(interfaces, i);
+                       physical = SCVLANInterfaceGetPhysicalInterface(vlanInterface);
+                       CFSetAddValue(excluded, physical);
+               }
+               CFRelease(interfaces);
+       }
+
+       // identify available interfaces
+       interfaces = __SCNetworkInterfaceCopyAll_IONetworkInterface();
+       if (interfaces != NULL) {
+               CFIndex i;
+               CFIndex n;
+
+               n = CFArrayGetCount(interfaces);
+               for (i = 0; i < n; i++) {
+                       SCNetworkInterfaceRef           interface;
+                       SCNetworkInterfacePrivateRef    interfacePrivate;
+
+                       interface = CFArrayGetValueAtIndex(interfaces, i);
+                       interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
+
+                       if (!interfacePrivate->supportsBridge) {
+                               // if this interface is not available
+                               continue;
+                       }
+
+                       if (CFSetContainsValue(excluded, interface)) {
+                               // if excluded
+                               continue;
+                       }
+
+                       CFArrayAppendValue(available, interface);
+               }
+               CFRelease(interfaces);
+       }
+
+       CFRelease(excluded);
+
+       return available;
+}
+
+
+CFArrayRef
+_SCBridgeInterfaceCopyActive(void)
+{
+       struct ifaddrs          *ifap;
+       struct ifaddrs          *ifp;
+       int                     s;
+       CFMutableArrayRef       bridges = 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;
+       }
+
+       bridges = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       for (ifp = ifap; ifp != NULL; ifp = ifp->ifa_next) {
+#ifdef IFT_BRIDGE
+               SCBridgeInterfaceRef            bridge;
+               CFStringRef                     bridge_if;
+               struct ifbifconf                *ibc_p;
+               struct if_data                  *if_data;
+               CFMutableArrayRef               members         = NULL;
+
+               if_data = (struct if_data *)ifp->ifa_data;
+               if (if_data == NULL
+                   || ifp->ifa_addr->sa_family != AF_LINK
+                   || if_data->ifi_type != IFT_BRIDGE) {
+                       continue;
+               }
+
+               ibc_p = ifbifconf_copy(s, ifp->ifa_name);
+               if (ibc_p == NULL) {
+                       if (errno == EBUSY) {
+                               continue;
+                       }
+                       _SCErrorSet(errno);
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("ifbifconf_copy(%s) failed: %s"),
+                             ifp->ifa_name,
+                             strerror(errno));
+                       CFRelease(bridges);
+                       bridges = NULL;
+                       goto done;
+               }
+
+               // create the bridge interface
+               bridge_if = CFStringCreateWithCString(NULL, ifp->ifa_name, kCFStringEncodingASCII);
+               bridge    = (SCBridgeInterfaceRef)_SCBridgeInterfaceCreatePrivate(NULL, bridge_if);
+               CFRelease(bridge_if);
+
+               // add member interfaces
+               if (ibc_p->ifbic_len > 0) {
+                       int             i;
+
+                       // iterate over each member interface
+                       for (i = 0; i < ibc_p->ifbic_len / sizeof(struct ifbreq); i++) {
+                               struct ifbreq   *ibr_p;
+                               CFStringRef     member;
+
+                               ibr_p = ibc_p->ifbic_req + i;
+                               member = CFStringCreateWithCString(NULL, ibr_p->ifbr_ifsname, kCFStringEncodingASCII);
+                               add_interface(&members, member);
+                               CFRelease(member);
+                       }
+               }
+               free(ibc_p);
+
+               if (members != NULL) {
+                       _SCBridgeInterfaceSetMemberInterfaces(bridge, members);
+                       CFRelease(members);
+               }
+
+               // add bridge
+               CFArrayAppendValue(bridges, bridge);
+               CFRelease(bridge);
+#endif // IFT_BRIDGE
+       }
+
+    done :
+
+       (void) close(s);
+       freeifaddrs(ifap);
+       return bridges;
+}
+
+
+SCBridgeInterfaceRef
+SCBridgeInterfaceCreate(SCPreferencesRef prefs)
+{
+       CFAllocatorRef          allocator;
+       SCBridgeInterfaceRef    bridge          = NULL;
+       CFIndex                 i;
+
+       if (prefs == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       allocator = CFGetAllocator(prefs);
+
+       // create a new bridge using an unused interface name
+       for (i = 0; bridge == NULL; i++) {
+               CFDictionaryRef                 dict;
+               CFStringRef                     bridge_if;
+               SCNetworkInterfacePrivateRef    interfacePrivate;
+               CFMutableDictionaryRef          newDict;
+               CFArrayRef                      newInterfaces;
+               Boolean                         ok;
+               CFStringRef                     path;
+
+               bridge_if = CFStringCreateWithFormat(allocator, NULL, CFSTR("bridge%d"), i);
+               path    = CFStringCreateWithFormat(allocator,
+                                                  NULL,
+                                                  CFSTR("/%@/%@/%@"),
+                                                  kSCPrefVirtualNetworkInterfaces,
+                                                  kSCNetworkInterfaceTypeBridge,
+                                                  bridge_if);
+               dict = SCPreferencesPathGetValue(prefs, path);
+               if (dict != NULL) {
+                       // if bridge interface name not available
+                       CFRelease(path);
+                       CFRelease(bridge_if);
+                       continue;
+               }
+
+               // add the bridge to the stored preferences
+               newDict = CFDictionaryCreateMutable(allocator,
+                                                   0,
+                                                   &kCFTypeDictionaryKeyCallBacks,
+                                                   &kCFTypeDictionaryValueCallBacks);
+               newInterfaces = CFArrayCreate(allocator, NULL, 0, &kCFTypeArrayCallBacks);
+               CFDictionaryAddValue(newDict, kSCPropVirtualNetworkInterfacesBridgeInterfaces, newInterfaces);
+               CFRelease(newInterfaces);
+               ok = SCPreferencesPathSetValue(prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+               if (!ok) {
+                       // if the bridge could not be saved
+                       CFRelease(bridge_if);
+                       break;
+               }
+
+               // create the SCBridgeInterfaceRef
+               bridge = (SCBridgeInterfaceRef)_SCBridgeInterfaceCreatePrivate(allocator, bridge_if);
+               CFRelease(bridge_if);
+
+               // estabish link to the stored configuration
+               interfacePrivate = (SCNetworkInterfacePrivateRef)bridge;
+               interfacePrivate->prefs = CFRetain(prefs);
+       }
+
+       return bridge;
+}
+
+
+Boolean
+SCBridgeInterfaceRemove(SCBridgeInterfaceRef bridge)
+{
+       CFStringRef                     bridge_if;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bridge;
+       Boolean                         ok;
+       CFStringRef                     path;
+
+       if (!isA_SCBridgeInterface(bridge)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (interfacePrivate->prefs == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       bridge_if = SCNetworkInterfaceGetBSDName(bridge);
+       path    = CFStringCreateWithFormat(NULL,
+                                          NULL,
+                                          CFSTR("/%@/%@/%@"),
+                                          kSCPrefVirtualNetworkInterfaces,
+                                          kSCNetworkInterfaceTypeBridge,
+                                          bridge_if);
+       ok = SCPreferencesPathRemoveValue(interfacePrivate->prefs, path);
+       CFRelease(path);
+
+       return ok;
+}
+
+
+CFArrayRef
+SCBridgeInterfaceGetMemberInterfaces(SCBridgeInterfaceRef bridge)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bridge;
+
+       if (!isA_SCBridgeInterface(bridge)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       return interfacePrivate->bridge.interfaces;
+}
+
+
+CFDictionaryRef
+SCBridgeInterfaceGetOptions(SCBridgeInterfaceRef bridge)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bridge;
+
+       if (!isA_SCBridgeInterface(bridge)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       return interfacePrivate->bridge.options;
+}
+
+
+static Boolean
+_SCBridgeInterfaceSetMemberInterfaces(SCBridgeInterfaceRef bridge, CFArrayRef members)
+{
+       CFIndex                         i;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bridge;
+       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;
+               CFMutableDictionaryRef  newDict;
+               CFStringRef             path;
+
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeBridge,
+                                               interfacePrivate->entity_device);
+               dict = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+               if (!isA_CFDictionary(dict)) {
+                       // if the prefs are confused
+                       CFRelease(path);
+                       _SCErrorSet(kSCStatusFailed);
+                       return FALSE;
+               }
+
+               newMembers = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               for (i = 0; i < n; i++) {
+                       SCNetworkInterfaceRef   interface;
+                       CFStringRef             memberName;
+
+                       interface = CFArrayGetValueAtIndex(members, i);
+                       memberName = SCNetworkInterfaceGetBSDName(interface);
+                       CFArrayAppendValue(newMembers, memberName);
+               }
+
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               CFDictionarySetValue(newDict, kSCPropVirtualNetworkInterfacesBridgeInterfaces, newMembers);
+               CFRelease(newMembers);
+
+               ok = SCPreferencesPathSetValue(interfacePrivate->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+       }
+
+       if (ok) {
+               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->bridge.interfaces);
+               interfacePrivate->bridge.interfaces = newMembers;
+       }
+
+       return ok;
+}
+
+
+Boolean
+SCBridgeInterfaceSetMemberInterfaces(SCBridgeInterfaceRef bridge, CFArrayRef members)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bridge;
+       Boolean                         ok;
+       int                             sc_status               = kSCStatusOK;
+
+       if (!isA_SCBridgeInterface(bridge)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((members != NULL) && !isA_CFArray(members)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (interfacePrivate->prefs != NULL) {
+               CFArrayRef      available;
+               CFArrayRef      current;
+               CFIndex         i;
+               CFIndex         n_available;
+               CFIndex         n_current;
+               CFIndex         n_members;
+               CFArrayRef      services        = NULL;
+
+               current     = SCBridgeInterfaceGetMemberInterfaces(bridge);
+               n_current   = (current != NULL) ? CFArrayGetCount(current) : 0;
+
+               available   = SCBridgeInterfaceCopyAvailableMemberInterfaces(interfacePrivate->prefs);
+               n_available = (available != NULL) ? CFArrayGetCount(available) : 0;
+
+               n_members = (members != NULL) ? CFArrayGetCount(members) : 0;
+               for (i = 0; i < n_members; i++) {
+                       SCNetworkInterfaceRef   member;
+
+                       member = CFArrayGetValueAtIndex(members, i);
+
+                       if ((current != NULL) &&
+                           CFArrayContainsValue(current, CFRangeMake(0, n_current), member)) {
+                               // current members are allowed
+                               continue;
+                       }
+
+                       if ((available != NULL) &&
+                           CFArrayContainsValue(available, CFRangeMake(0, n_available), member)) {
+                               // available members are allowed but cannot be associated
+                               // with any other network services.
+
+                               if (services == NULL) {
+                                       services = __SCNetworkServiceCopyAllEnabled(interfacePrivate->prefs);
+                               }
+                               if ((services != NULL) &&
+                                   __SCNetworkServiceExistsForInterface(services, member)) {
+                                       sc_status = kSCStatusKeyExists;
+                                       break;
+                               }
+
+                               // if available
+                               continue;
+                       }
+
+                       // if member not allowed
+                       sc_status = kSCStatusInvalidArgument;
+                       break;
+               }
+
+               if (available != NULL) CFRelease(available);
+               if (services != NULL) CFRelease(services);
+       }
+
+       if (sc_status != kSCStatusOK) {
+               _SCErrorSet(sc_status);
+               return FALSE;
+       }
+
+       ok = _SCBridgeInterfaceSetMemberInterfaces(bridge, members);
+       return ok;
+}
+
+
+Boolean
+SCBridgeInterfaceSetLocalizedDisplayName(SCBridgeInterfaceRef bridge, CFStringRef newName)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bridge;
+       Boolean                         ok                      = TRUE;
+
+       if (!isA_SCBridgeInterface(bridge)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((newName != NULL) && !isA_CFString(newName)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // set name in the stored preferences
+       if (interfacePrivate->prefs != NULL) {
+               CFDictionaryRef         dict;
+               CFMutableDictionaryRef  newDict;
+               CFStringRef             path;
+
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeBridge,
+                                               interfacePrivate->entity_device);
+               dict = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+               if (!isA_CFDictionary(dict)) {
+                       // if the prefs are confused
+                       CFRelease(path);
+                       _SCErrorSet(kSCStatusFailed);
+                       return FALSE;
+               }
+
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               if (newName != NULL) {
+                       CFDictionarySetValue(newDict, kSCPropUserDefinedName, newName);
+               } else {
+                       CFDictionaryRemoveValue(newDict, kSCPropUserDefinedName);
+               }
+               ok = SCPreferencesPathSetValue(interfacePrivate->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+       }
+
+       // set name in the SCBridgeInterfaceRef
+       if (ok) {
+               if (interfacePrivate->localized_name != NULL) {
+                       CFRelease(interfacePrivate->localized_name);
+                       interfacePrivate->localized_name = NULL;
+               }
+               if (newName != NULL) {
+                       interfacePrivate->localized_name = CFStringCreateCopy(NULL, newName);
+               }
+       }
+
+       return ok;
+}
+
+
+Boolean
+SCBridgeInterfaceSetOptions(SCBridgeInterfaceRef bridge, CFDictionaryRef newOptions)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bridge;
+       Boolean                         ok                      = TRUE;
+
+       if (!isA_SCBridgeInterface(bridge)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((newOptions != NULL) && !isA_CFDictionary(newOptions)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       // set options in the stored preferences
+       if (interfacePrivate->prefs != NULL) {
+               CFDictionaryRef         dict;
+               CFMutableDictionaryRef  newDict;
+               CFStringRef             path;
+
+               path = CFStringCreateWithFormat(NULL,
+                                               NULL,
+                                               CFSTR("/%@/%@/%@"),
+                                               kSCPrefVirtualNetworkInterfaces,
+                                               kSCNetworkInterfaceTypeBridge,
+                                               interfacePrivate->entity_device);
+               dict = SCPreferencesPathGetValue(interfacePrivate->prefs, path);
+               if (!isA_CFDictionary(dict)) {
+                       // if the prefs are confused
+                       CFRelease(path);
+                       _SCErrorSet(kSCStatusFailed);
+                       return FALSE;
+               }
+
+               newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
+               if (newOptions != NULL) {
+                       CFDictionarySetValue(newDict, kSCPropVirtualNetworkInterfacesBridgeOptions, newOptions);
+               } else {
+                       CFDictionaryRemoveValue(newDict, kSCPropVirtualNetworkInterfacesBridgeOptions);
+               }
+               ok = SCPreferencesPathSetValue(interfacePrivate->prefs, path, newDict);
+               CFRelease(newDict);
+               CFRelease(path);
+       }
+
+       // set options in the SCBridgeInterfaceRef
+       if (ok) {
+               if (interfacePrivate->bridge.options != NULL) {
+                       CFRelease(interfacePrivate->bridge.options);
+                       interfacePrivate->bridge.options = NULL;
+               }
+               if (newOptions != NULL) {
+                       interfacePrivate->bridge.options = CFDictionaryCreateCopy(NULL, newOptions);
+               }
+       }
+
+       return ok;
+}
+
+
+#pragma mark -
+#pragma mark SCBridgeInterface management
+
+
+#ifdef IFT_BRIDGE
+static Boolean
+__bridge_add_interface(int s, CFStringRef bridge_if, CFStringRef interface_if)
+{
+       struct ifbreq   breq;
+       struct ifdrv    ifd;
+
+       // bridge interface
+       bzero(&ifd, sizeof(ifd));
+       (void) _SC_cfstring_to_cstring(bridge_if,
+                                      ifd.ifd_name,
+                                      sizeof(ifd.ifd_name),
+                                      kCFStringEncodingASCII);
+       ifd.ifd_cmd = BRDGADD;
+       ifd.ifd_len = sizeof(breq);
+       ifd.ifd_data = (caddr_t)&breq;
+
+       // new bridge member
+       bzero(&breq, sizeof(breq));
+       (void) _SC_cfstring_to_cstring(interface_if,
+                                      breq.ifbr_ifsname,
+                                      sizeof(breq.ifbr_ifsname),
+                                      kCFStringEncodingASCII);
+
+       // add new bridge member
+       if (ioctl(s, SIOCSDRVSPEC, (caddr_t)&ifd) == -1) {
+               _SCErrorSet(errno);
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("could not add interface \"%@\" to bridge \"%@\": %s"),
+                     interface_if,
+                     bridge_if,
+                     strerror(errno));
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+static Boolean
+__bridge_remove_interface(int s, CFStringRef bridge_if, CFStringRef interface_if)
+{
+       struct ifbreq   breq;
+       struct ifdrv    ifd;
+
+       // bridge interface
+       bzero(&ifd, sizeof(ifd));
+       (void) _SC_cfstring_to_cstring(bridge_if,
+                                      ifd.ifd_name,
+                                      sizeof(ifd.ifd_name),
+                                      kCFStringEncodingASCII);
+       ifd.ifd_cmd = BRDGDEL;
+       ifd.ifd_len = sizeof(breq);
+       ifd.ifd_data = (caddr_t)&breq;
+
+       // bridge member to remove
+       bzero(&breq, sizeof(breq));
+       (void) _SC_cfstring_to_cstring(interface_if,
+                                      breq.ifbr_ifsname,
+                                      sizeof(breq.ifbr_ifsname),
+                                      kCFStringEncodingASCII);
+
+       // remove bridge member
+       if (ioctl(s, SIOCSDRVSPEC, (caddr_t)&ifd) == -1) {
+               _SCErrorSet(errno);
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("could not add interface \"%@\" to bridge \"%@\": %s"),
+                     interface_if,
+                     bridge_if,
+                     strerror(errno));
+               return FALSE;
+       }
+
+       return TRUE;
+}
+#endif // IFT_BRIDGE
+
+
+Boolean
+_SCBridgeInterfaceUpdateConfiguration(SCPreferencesRef prefs)
+{
+#ifdef IFT_BRIDGE
+       CFArrayRef                      active          = NULL;
+       CFArrayRef                      config          = NULL;
+       CFIndex                         i;
+       CFIndex                         nActive;
+       CFIndex                         nConfig;
+       Boolean                         ok              = TRUE;
+       int                             s               = -1;
+
+       if (prefs == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       /* configured Bridges */
+       config  = SCBridgeInterfaceCopyAll(prefs);
+       nConfig = (config != NULL) ? CFArrayGetCount(config) : 0;
+
+       /* active Bridges */
+       active  = _SCBridgeInterfaceCopyActive();
+       nActive = (active != NULL) ? CFArrayGetCount(active) : 0;
+
+       /*
+        * remove any no-longer-configured bridge interfaces and
+        * any devices associated with a bridge that are no longer
+        * associated with a bridge.
+        */
+       for (i = 0; i < nActive; i++) {
+               SCBridgeInterfaceRef    a_bridge;
+               CFStringRef             a_bridge_if;
+               CFIndex                 j;
+               Boolean                 found   = FALSE;
+
+               a_bridge    = CFArrayGetValueAtIndex(active, i);
+               a_bridge_if = SCNetworkInterfaceGetBSDName(a_bridge);
+
+               for (j = 0; j < nConfig; j++) {
+                       SCBridgeInterfaceRef    c_bridge;
+                       CFStringRef             c_bridge_if;
+
+                       c_bridge    = CFArrayGetValueAtIndex(config, j);
+                       c_bridge_if = SCNetworkInterfaceGetBSDName(c_bridge);
+
+                       if (CFEqual(a_bridge_if, c_bridge_if)) {
+                               CFIndex         a;
+                               CFArrayRef      a_bridge_interfaces;
+                               CFIndex         a_count;
+                               CFArrayRef      c_bridge_interfaces;
+                               CFIndex         c_count;
+
+                               c_bridge_interfaces = SCBridgeInterfaceGetMemberInterfaces(c_bridge);
+                               c_count           = (c_bridge_interfaces != NULL) ? CFArrayGetCount(c_bridge_interfaces) : 0;
+
+                               a_bridge_interfaces = SCBridgeInterfaceGetMemberInterfaces(a_bridge);
+                               a_count           = (a_bridge_interfaces != NULL) ? CFArrayGetCount(a_bridge_interfaces) : 0;
+
+                               for (a = 0; a < a_count; a++) {
+                                       SCNetworkInterfaceRef   a_interface;
+                                       CFStringRef             a_interface_if;
+
+                                       a_interface = CFArrayGetValueAtIndex(a_bridge_interfaces, a);
+                                       if ((c_count == 0) ||
+                                           !CFArrayContainsValue(c_bridge_interfaces,
+                                                                 CFRangeMake(0, c_count),
+                                                                 a_interface)) {
+                                               /*
+                                                * if this device is no longer part
+                                                * of the bridge.
+                                                */
+                                               if (s == -1) {
+                                                       s = inet_dgram_socket();
+                                                       if (s == -1) {
+                                                               _SCErrorSet(errno);
+                                                               ok = FALSE;
+                                                               goto done;
+                                                       }
+                                               }
+
+                                               a_interface_if = SCNetworkInterfaceGetBSDName(a_interface);
+                                               if (!__bridge_remove_interface(s, a_bridge_if, a_interface_if)) {
+                                                       ok = FALSE;
+                                               }
+                                       }
+                               }
+
+                               found = TRUE;
+                               break;
+                       }
+               }
+
+               if (!found) {
+                       /*
+                        * if this interface is no longer configured
+                        */
+                       if (s == -1) {
+                               s = inet_dgram_socket();
+                               if (s == -1) {
+                                       _SCErrorSet(errno);
+                                       ok = FALSE;
+                                       goto done;
+                               }
+                       }
+
+                       if (!__destroyInterface(s, a_bridge_if)) {
+                               _SCErrorSet(errno);
+                               ok = FALSE;
+                       }
+               }
+       }
+
+       /*
+        * add any newly-configured bridge interfaces and add any
+        * devices that should now be associated with the bridge.
+        */
+       for (i = 0; i < nConfig; i++) {
+               SCBridgeInterfaceRef    c_bridge;
+               CFArrayRef              c_bridge_interfaces;
+               CFStringRef             c_bridge_if;
+               CFIndex                 c_count;
+               Boolean                 found           = FALSE;
+               CFIndex                 j;
+
+               c_bridge            = CFArrayGetValueAtIndex(config, i);
+               c_bridge_if         = SCNetworkInterfaceGetBSDName(c_bridge);
+               c_bridge_interfaces = SCBridgeInterfaceGetMemberInterfaces(c_bridge);
+               c_count             = (c_bridge_interfaces != NULL) ? CFArrayGetCount(c_bridge_interfaces) : 0;
+
+               for (j = 0; j < nActive; j++) {
+                       SCBridgeInterfaceRef    a_bridge;
+                       CFArrayRef              a_bridge_interfaces;
+                       CFStringRef             a_bridge_if;
+                       CFIndex                 a_count;
+
+                       a_bridge            = CFArrayGetValueAtIndex(active, j);
+                       a_bridge_if         = SCNetworkInterfaceGetBSDName(a_bridge);
+                       a_bridge_interfaces = SCBridgeInterfaceGetMemberInterfaces(a_bridge);
+                       a_count             = (a_bridge_interfaces != NULL) ? CFArrayGetCount(a_bridge_interfaces) : 0;
+
+                       if (CFEqual(c_bridge_if, a_bridge_if)) {
+                               CFIndex c;
+                               Boolean if_list_change = FALSE;
+
+                               found = TRUE;
+
+                               if (!_SC_CFEqual(c_bridge_interfaces, a_bridge_interfaces)) {
+                                       if_list_change = TRUE;
+                               }
+                               if (!if_list_change) {
+                                       break;  // if no change
+                               }
+                               if (s == -1) {
+                                       s = inet_dgram_socket();
+                                       if (s == -1) {
+                                               _SCErrorSet(errno);
+                                               ok = FALSE;
+                                               goto done;
+                                       }
+                               }
+                               if (!if_list_change) {
+                                       break; // no if list changes
+                               }
+
+                               /*
+                                * ensure that the first device of the bridge matches, if
+                                * not then we remove all current devices and add them
+                                * back in the preferred order.
+                                */
+                               if ((c_count > 0) &&
+                                   (a_count > 0) &&
+                                   !CFEqual(CFArrayGetValueAtIndex(c_bridge_interfaces, 0),
+                                            CFArrayGetValueAtIndex(a_bridge_interfaces, 0))) {
+                                       CFIndex a;
+
+                                       for (a = 0; a < a_count; a++) {
+                                               SCNetworkInterfaceRef   a_interface;
+                                               CFStringRef             a_interface_if;
+
+                                               a_interface = CFArrayGetValueAtIndex(a_bridge_interfaces, a);
+                                               if (!CFArrayContainsValue(c_bridge_interfaces,
+                                                                        CFRangeMake(0, c_count),
+                                                                        a_interface)) {
+                                                       continue;       // if already removed
+                                               }
+
+                                               a_interface_if = SCNetworkInterfaceGetBSDName(a_interface);
+                                               if (!__bridge_remove_interface(s, a_bridge_if, a_interface_if)) {
+                                                       ok = FALSE;
+                                               }
+                                       }
+
+                                       a_count = 0;    // all active devices have been removed
+                               }
+
+                               /*
+                                * add any devices which are not currently associated
+                                * with the bridge interface.
+                                */
+                               for (c = 0; c < c_count; c++) {
+                                       SCNetworkInterfaceRef           c_interface;
+                                       SCNetworkInterfacePrivateRef    c_interfacePrivate;
+                                       CFStringRef                     c_interface_if;
+
+                                       c_interface = CFArrayGetValueAtIndex(c_bridge_interfaces, c);
+                                       if ((a_count == 0) ||
+                                           !CFArrayContainsValue(a_bridge_interfaces,
+                                                                 CFRangeMake(0, a_count),
+                                                                 c_interface)) {
+                                               /*
+                                                * check if this member interface can be added to a bridge.
+                                                */
+                                               c_interfacePrivate = (SCNetworkInterfacePrivateRef)c_interface;
+                                               if (!c_interfacePrivate->supportsBridge) {
+                                                       // if member not supported
+                                                       continue;
+                                               }
+
+                                               /*
+                                                * if this member interface is not currently part of the bridge.
+                                                */
+                                               c_interface_if = SCNetworkInterfaceGetBSDName(c_interface);
+                                               if (!__bridge_add_interface(s, c_bridge_if, c_interface_if)) {
+                                                       // if member could not be added
+                                                       ok = FALSE;
+                                               }
+                                       }
+                               }
+
+                               break;
+                       }
+               }
+
+               if (!found) {
+                       CFIndex c;
+
+                       if (s == -1) {
+                               s = inet_dgram_socket();
+                               if (s == -1) {
+                                       _SCErrorSet(errno);
+                                       ok = FALSE;
+                                       goto done;
+                               }
+                       }
+
+                       /*
+                        * establish the new bridge interface.
+                        */
+                       if (!__createInterface(s, c_bridge_if)) {
+                               _SCErrorSet(errno);
+                               ok = FALSE;
+                               continue;
+                       }
+
+                       /*
+                        * add the member interfaces
+                        */
+                       for (c = 0; c < c_count; c++) {
+                               SCNetworkInterfaceRef           c_interface;
+                               SCNetworkInterfacePrivateRef    c_interfacePrivate;
+                               CFStringRef                     c_interface_if;
+
+                               c_interface = CFArrayGetValueAtIndex(c_bridge_interfaces, c);
+                               c_interfacePrivate = (SCNetworkInterfacePrivateRef)c_interface;
+                               if (!c_interfacePrivate->supportsBridge) {
+                                       // if member not supported
+                                       continue;
+                               }
+
+                               c_interface_if = SCNetworkInterfaceGetBSDName(c_interface);
+                               if (!__bridge_add_interface(s, c_bridge_if, c_interface_if)) {
+                                       // if member could not be added
+                                       ok = FALSE;
+                               }
+                       }
+               }
+
+       }
+
+    done :
+
+       if (active != NULL)     CFRelease(active);
+       if (config != NULL)     CFRelease(config);
+       if (s != -1)            (void) close(s);
+
+       return ok;
+#else  // IFT_BRIDGE
+       return TRUE;
+#endif // IFT_BRIDGE
+}
diff --git a/SystemConfiguration.fproj/CaptiveNetwork.c b/SystemConfiguration.fproj/CaptiveNetwork.c
new file mode 100644 (file)
index 0000000..413ebce
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2009, 2010 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 <sys/types.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <dlfcn.h>
+
+#include <SystemConfiguration/CaptiveNetwork.h>
+
+
+#pragma mark -
+#pragma mark CaptiveNetwork.framework APIs (exported through the SystemConfiguration.framework)
+
+const CFStringRef kCNNetworkInfoKeySSIDData    = CFSTR("SSIDDATA");
+const CFStringRef kCNNetworkInfoKeySSID        = CFSTR("SSID");
+const CFStringRef kCNNetworkInfoKeyBSSID       = CFSTR("BSSID");
+
+static void *
+__loadCaptiveNetwork(void) {
+       static void *image = NULL;
+       if (NULL == image) {
+               const char      *framework              = "/System/Library/PrivateFrameworks/CaptiveNetwork.framework/CaptiveNetwork";
+               struct stat     statbuf;
+               const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
+               char            path[MAXPATHLEN];
+
+               strlcpy(path, framework, sizeof(path));
+               if (suffix) strlcat(path, suffix, sizeof(path));
+               if (0 <= stat(path, &statbuf)) {
+                       image = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
+               } else {
+                       image = dlopen(framework, RTLD_LAZY | RTLD_LOCAL);
+               }
+       }
+       return (void *)image;
+}
+
+
+Boolean
+CNSetSupportedSSIDs(CFArrayRef ssidArray)
+{
+       static typeof (CNSetSupportedSSIDs) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadCaptiveNetwork();
+               if (image) dyfunc = dlsym(image, "__CNSetSupportedSSIDs");
+       }
+       return dyfunc ? dyfunc(ssidArray) : FALSE;
+}
+
+
+Boolean
+CNMarkPortalOnline(CFStringRef interfaceName)
+{
+       static typeof (CNMarkPortalOnline) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadCaptiveNetwork();
+               if (image) dyfunc = dlsym(image, "__CNMarkPortalOnline");
+       }
+       return dyfunc ? dyfunc(interfaceName) : FALSE;
+}
+
+
+Boolean
+CNMarkPortalOffline(CFStringRef interfaceName)
+{
+       static typeof (CNMarkPortalOffline) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadCaptiveNetwork();
+               if (image) dyfunc = dlsym(image, "__CNMarkPortalOffline");
+       }
+       return dyfunc ? dyfunc(interfaceName) : FALSE;
+}
+
+CFArrayRef
+CNCopySupportedInterfaces(void)
+{
+       static typeof (CNCopySupportedInterfaces) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadCaptiveNetwork();
+               if (image) dyfunc = dlsym(image, "__CNCopySupportedInterfaces");
+       }
+       return dyfunc ? dyfunc() : NULL;
+}
+
+CFDictionaryRef
+CNCopyCurrentNetworkInfo(CFStringRef   interfaceName)
+{
+       static typeof (CNCopyCurrentNetworkInfo) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadCaptiveNetwork();
+               if (image) dyfunc = dlsym(image, "__CNCopyCurrentNetworkInfo");
+       }
+       return dyfunc ? dyfunc(interfaceName) : NULL;
+}
diff --git a/SystemConfiguration.fproj/CaptiveNetwork.h b/SystemConfiguration.fproj/CaptiveNetwork.h
new file mode 100644 (file)
index 0000000..78d8fb9
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2009, 2010 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@
+ */
+
+#ifndef _CAPTIVENETWORK_H
+#define _CAPTIVENETWORK_H
+
+#include <Availability.h>
+#include <sys/cdefs.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+/*!
+       @header CaptiveNetwork
+       @discussion The CaptiveNetwork API allows applications to interact
+               with Captive Network Support. Captive Network Support is a
+               system component responsible for detecting and help users
+               navigate networks that require interaction before providing
+               internet access. The most common Captive Networks are WiFi
+               Hotspots in places like airports, restaurants, and hotels.
+               Captive Network Support will attempt to authenticate if
+               possible or drop a user in to a web sheet if authentication
+               is not possible. In the web sheet the user has an opportunity
+               to authenticate or disassociate from the network.
+
+               The following APIs are designed for third party applications
+               that may handle authentication on these networks on behalf of
+               the user.
+
+               These APIs are treated as advisory only.
+               There is no guarantee or contract that the operating system
+               will take the intended action.
+ */
+
+__BEGIN_DECLS
+
+/*!
+       @function CNSetSupportedSSIDs
+       @discussion Provides Captive Network Support with an updated list of
+               SSIDs that this application will perform authentication on.
+               When Captive Network Support would show the Web Sheet for a
+               network with an SSID the application has registered for, it
+               will suppress showing the Web Sheet if the application is
+               still installed.
+       @param ssidArray A CFArray of CFStrings of the SSIDs.
+       @result Returns TRUE if the operation succeeded, FALSE otherwise.
+ */
+Boolean
+CNSetSupportedSSIDs    (CFArrayRef     ssidArray)              __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
+
+/*!
+       @function CNMarkPortalOnline
+       @discussion Tells Captive Network Support that your application has
+               authenticated the device to the network. Captive Network Support
+               will notify the rest of the system that WiFi is now a viable
+               interface.
+       @param interfaceName Name of the interface that is now online.
+       @result Returns TRUE if the operation succeeded, FALSE otherwise.
+ */
+Boolean
+CNMarkPortalOnline     (CFStringRef    interfaceName)          __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
+
+/*!
+       @function CNMarkPortalOffline
+       @discussion Tells Captive Network Support that the device is not
+               authenticated on the given network interface.
+       @param interfaceName Name of the interface that is still captive.
+       @result Returns TRUE if the operation succeeded, FALSE otherwise.
+ */
+Boolean
+CNMarkPortalOffline    (CFStringRef    interfaceName)          __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
+
+
+/*!
+ @function CNCopySupportedInterfaces
+ @discussion copies a list of all interfaces CaptiveNetworkSupport is monitoring.
+ @result An array of CFStringRef- BSD interface names.
+        Returns NULL if an error was encountered.
+        You MUST release the returned value.
+ */
+CFArrayRef
+CNCopySupportedInterfaces      (void)                          __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_1);
+
+/*!
+ @constant kCNNetworkInfoKeySSIDData
+ @discussion NetworkInfo Dictionary key for SSID in CFData format
+ */
+extern const CFStringRef kCNNetworkInfoKeySSIDData             __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_1);
+
+/*!
+ @constant kCNNetworkInfoKeySSID
+ @discussion NetworkInfo Dictionary key for SSID in CFString format
+ */
+extern const CFStringRef kCNNetworkInfoKeySSID                 __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_1);
+
+/*!
+ @constant kCNNetworkInfoKeyBSSID
+ @discussion NetworkInfo Dictionary key for BSSID in CFString format
+ */
+extern const CFStringRef kCNNetworkInfoKeyBSSID                        __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_1);
+
+/*!
+ @function CNCopyCurrentNetworkInfo
+ @discussion Returns the Network Info for the specified interface.
+       For example, Network Info dictionary will contain the following
+       keys, and values:
+       <pre>
+       @textblock
+       Keys                      : Values
+       =======================================
+       kCNNetworkInfoKeySSIDData : CFDataRef
+       kCNNetworkInfoKeySSID     : CFStringRef
+       kCNNetworkInfoKeyBSSID    : CFStringRef
+       @/textblock
+       </pre>
+ @param interfaceName Name of the interface you are interested in
+ @result Network Info dictionary associated with the interface.
+        Returns NULL if an error was encountered.
+        You MUST release the returned value.
+ */
+CFDictionaryRef
+CNCopyCurrentNetworkInfo       (CFStringRef interfaceName)     __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_1);
+
+__END_DECLS
+
+#endif /* _CAPTIVENETWORK_H */
index 87406e7c67fcbda09260e06507699978b6c1a778..49e8abe7369bcfa1883f96e0239946f2a13b9f56 100644 (file)
Binary files a/SystemConfiguration.fproj/English.lproj/Localizable.strings and b/SystemConfiguration.fproj/English.lproj/Localizable.strings differ
index 9a0d08b25dbffbaa46661467018aeb5b155c6402..fe6b31b7bdf48cec1e1088599dae58108e1327cb 100644 (file)
Binary files a/SystemConfiguration.fproj/English.lproj/NetworkInterface.strings and b/SystemConfiguration.fproj/English.lproj/NetworkInterface.strings differ
index c44f15a20ad8e9ae5d20f2d062b849b96badd53d..5597be55d5da82e9856fd69f705e500ca6d16c7a 100644 (file)
@@ -7,7 +7,7 @@
        <key>CFBundleExecutable</key>
        <string>SystemConfiguration</string>
        <key>CFBundleGetInfoString</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
        <key>CFBundleIdentifier</key>
        <string>com.apple.SystemConfiguration</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <key>CFBundlePackageType</key>
        <string>FMWK</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
 </dict>
 </plist>
index c44f15a20ad8e9ae5d20f2d062b849b96badd53d..5597be55d5da82e9856fd69f705e500ca6d16c7a 100644 (file)
@@ -7,7 +7,7 @@
        <key>CFBundleExecutable</key>
        <string>SystemConfiguration</string>
        <key>CFBundleGetInfoString</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
        <key>CFBundleIdentifier</key>
        <string>com.apple.SystemConfiguration</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <key>CFBundlePackageType</key>
        <string>FMWK</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.10.8</string>
+       <string>1.11</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.10.2</string>
+       <string>1.11</string>
 </dict>
 </plist>
index 145c44bbdd2cfc58d8989158038f32ef33e35678..0d03d7e17e2b7db2a64caf41f04f2141177003b9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2007, 2010, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <net/if_vlan_var.h>
 #include <net/if_media.h>
 #include <net/if_types.h>
+#include <netinet/in.h>
+#include <netinet/ip6.h>                       // for IPV6_MMTU
 
 #include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCPrivate.h>                     // for SCLog()
+#include <SystemConfiguration/SCPrivate.h>     // for SCLog()
 #include "SCNetworkConfigurationInternal.h"    // for __SCNetworkInterfaceCreatePrivate
 #include <SystemConfiguration/SCValidation.h>
 
 #include "dy_framework.h"
 
 
+#pragma mark -
+#pragma mark Capabilities
+
+
+// the following table needs to keep the capabilitiy names and values
+// between the <SystemConfiguration/SCSchemaDefinitionsPrivate.h> and
+// <net/if.h> headers in sync.
+static const struct {
+       const CFStringRef       *name;
+       Boolean                 readwrite;
+       int                     val;
+} capabilityMappings[] = {
+#ifdef SIOCGIFCAP
+       { &kSCPropNetEthernetCapabilityRXCSUM,          TRUE,   IFCAP_RXCSUM            },      // can offload checksum on RX
+       { &kSCPropNetEthernetCapabilityTXCSUM,          TRUE,   IFCAP_TXCSUM            },      // can offload checksum on TX
+       { &kSCPropNetEthernetCapabilityVLAN_MTU,        FALSE,  IFCAP_VLAN_MTU          },      // VLAN-compatible MTU
+       { &kSCPropNetEthernetCapabilityVLAN_HWTAGGING,  FALSE,  IFCAP_VLAN_HWTAGGING    },      // hardware VLAN tag support
+       { &kSCPropNetEthernetCapabilityJUMBO_MTU,       FALSE,  IFCAP_JUMBO_MTU         },      // 9000 byte MTU supported
+       { &kSCPropNetEthernetCapabilityTSO,             TRUE,   IFCAP_TSO               },      // can do TCP/TCP6 Segmentation Offload
+       { &kSCPropNetEthernetCapabilityTSO4,            FALSE,  IFCAP_TSO4              },      // can do TCP Segmentation Offload
+       { &kSCPropNetEthernetCapabilityTSO6,            FALSE,  IFCAP_TSO6              },      // can do TCP6 Segmentation Offload
+       { &kSCPropNetEthernetCapabilityLRO,             TRUE,   IFCAP_LRO               },      // can do Large Receive Offload
+       { &kSCPropNetEthernetCapabilityAV,              TRUE,   IFCAP_AV                },      // can do 802.1 AV Bridging
+#endif // SIOCGIFCAP
+};
+
+
+static CFIndex
+findCapability(CFStringRef capability)
+{
+       CFIndex         i;
+
+       for (i = 0; i < sizeof(capabilityMappings) / sizeof(capabilityMappings[0]); i++) {
+               if (CFEqual(capability, *capabilityMappings[i].name)) {
+                       return i;
+               }
+       }
+
+       return kCFNotFound;
+}
+
+
+static Boolean
+__getCapabilities(CFStringRef  interfaceName,
+                 int           *current,
+                 int           *available)
+{
+#ifdef SIOCGIFCAP
+       struct ifreq    ifr;
+       Boolean         ok              = FALSE;
+       int             sock            = -1;
+
+       bzero((void *)&ifr, sizeof(ifr));
+       if (_SC_cfstring_to_cstring(interfaceName, ifr.ifr_name, sizeof(ifr.ifr_name), kCFStringEncodingASCII) == NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("could not convert interface name"));
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       sock = socket(AF_INET, SOCK_DGRAM, 0);
+       if (sock == -1) {
+               _SCErrorSet(errno);
+               SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
+               return FALSE;
+       }
+
+       if (ioctl(sock, SIOCGIFCAP, (caddr_t)&ifr) == -1) {
+               _SCErrorSet(errno);
+               SCLog(TRUE, LOG_ERR, CFSTR("ioctl(SIOCGIFCAP) failed: %s"), strerror(errno));
+               goto done;
+       }
+
+       if (current   != NULL)  *current   = ifr.ifr_curcap;
+       if (available != NULL)  *available = ifr.ifr_reqcap;
+
+       ok = TRUE;
+
+    done :
+
+       (void)close(sock);
+       return ok;
+#else  // SIOCGIFCAP
+       if (current != NULL)    *current = 0;
+       if (available != NULL)  *available = 0;
+       return TRUE;
+#endif // SIOCGIFCAP
+}
+
+
+int
+__SCNetworkInterfaceCreateCapabilities(SCNetworkInterfaceRef   interface,
+                                      int                      capability_base,
+                                      CFDictionaryRef          capability_options)
+{
+       int             cap_available   = 0;
+       int             cap_current     = capability_base;
+       CFIndex         i;
+       CFStringRef     interfaceName;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               goto done;
+       }
+
+       interfaceName = SCNetworkInterfaceGetBSDName(interface);
+       if (interfaceName == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               goto done;
+       }
+
+       if (!__getCapabilities(interfaceName,
+                              (capability_base == -1) ? &cap_current : NULL,
+                              &cap_available)) {
+               goto done;
+       }
+
+       if (cap_available == 0) {
+               goto done;
+       }
+
+       if (capability_options == NULL) {
+               goto done;
+       }
+
+       for (i = 0; i < sizeof(capabilityMappings) / sizeof(capabilityMappings[0]); i++) {
+               int             cap_val;
+               CFTypeRef       val;
+
+               if (((cap_available & capabilityMappings[i].val) != 0) &&
+                   capabilityMappings[i].readwrite &&
+                   CFDictionaryGetValueIfPresent(capability_options,
+                                                 *capabilityMappings[i].name,
+                                                 &val) &&
+                   isA_CFNumber(val) &&
+                   CFNumberGetValue(val, kCFNumberIntType, &cap_val)) {
+                       // update capability
+                       if (cap_val != 0) {
+                               cap_current |= (cap_available & capabilityMappings[i].val);
+                       } else {
+                               cap_current &= ~capabilityMappings[i].val;
+                       }
+
+                       // don't process again
+                       cap_available &= ~capabilityMappings[i].val;
+               }
+       }
+
+    done :
+
+       return cap_current;
+}
+
+
+CFTypeRef
+SCNetworkInterfaceCopyCapability(SCNetworkInterfaceRef interface,
+                                CFStringRef            capability)
+{
+       int             cap_current     = 0;
+       int             cap_available   = 0;
+       int             cap_val;
+       CFIndex         i;
+       CFStringRef     interfaceName;
+       CFTypeRef       val             = NULL;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       interfaceName = SCNetworkInterfaceGetBSDName(interface);
+       if (interfaceName == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (!__getCapabilities(interfaceName, &cap_current, &cap_available)) {
+               return NULL;
+       }
+
+       if (capability == NULL) {
+               CFMutableDictionaryRef  all     = NULL;
+
+               // if ALL capabilities requested
+               for (i = 0; i < sizeof(capabilityMappings) / sizeof(capabilityMappings[0]); i++) {
+                       if ((cap_available & capabilityMappings[i].val) == capabilityMappings[i].val) {
+                               if (all == NULL) {
+                                       all = CFDictionaryCreateMutable(NULL,
+                                                                       0,
+                                                                       &kCFTypeDictionaryKeyCallBacks,
+                                                                       &kCFTypeDictionaryValueCallBacks);
+                               }
+                               cap_val = ((cap_current & capabilityMappings[i].val) == capabilityMappings[i].val) ? 1 : 0;
+                               val = CFNumberCreate(NULL, kCFNumberIntType, &cap_val);
+                               CFDictionarySetValue(all, *capabilityMappings[i].name, val);
+                               CFRelease(val);
+                               cap_available &= ~capabilityMappings[i].val;
+                       }
+               }
+
+               val = all;
+       } else {
+               i = findCapability(capability);
+               if (i == kCFNotFound) {
+                       // if unknown capability
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+
+               if ((cap_available & capabilityMappings[i].val) != capabilityMappings[i].val) {
+                       // if capability not available
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+
+               cap_val = ((cap_current & capabilityMappings[i].val) == capabilityMappings[i].val) ? 1 : 0;
+               val = CFNumberCreate(NULL, kCFNumberIntType, &cap_val);
+       }
+
+       return val;
+}
+
+
+Boolean
+SCNetworkInterfaceSetCapability(SCNetworkInterfaceRef  interface,
+                               CFStringRef             capability,
+                               CFTypeRef               newValue)
+{
+       int                     cap_available           = 0;
+       CFDictionaryRef         configuration;
+       CFIndex                 i;
+       CFStringRef             interfaceName;
+       CFMutableDictionaryRef  newConfiguration        = NULL;
+       Boolean                 ok                      = FALSE;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       interfaceName = SCNetworkInterfaceGetBSDName(interface);
+       if (interfaceName == NULL) {
+               // if no interface name
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       i = findCapability(capability);
+       if (i == kCFNotFound) {
+               // if unknown capability
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!capabilityMappings[i].readwrite) {
+               // if not read-write
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if ((newValue != NULL) && !isA_CFNumber(newValue)) {
+               // all values must (for now) be CFNumber[0 or 1]'s
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!__getCapabilities(interfaceName, NULL, &cap_available)) {
+               return FALSE;
+       }
+
+       if ((cap_available & capabilityMappings[i].val) == 0) {
+               // if capability not available
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       configuration = SCNetworkInterfaceGetConfiguration(interface);
+       if (configuration == NULL) {
+               newConfiguration = CFDictionaryCreateMutable(NULL,
+                                                            0,
+                                                            &kCFTypeDictionaryKeyCallBacks,
+                                                            &kCFTypeDictionaryValueCallBacks);
+       } else {
+               newConfiguration = CFDictionaryCreateMutableCopy(NULL, 0, configuration);
+               CFDictionaryRemoveValue(newConfiguration, kSCResvInactive);
+       }
+
+       if ((newValue != NULL)) {
+               CFDictionarySetValue(newConfiguration, capability, newValue);
+       } else {
+               CFDictionaryRemoveValue(newConfiguration, capability);
+               if (CFDictionaryGetCount(newConfiguration) == 0) {
+                       CFRelease(newConfiguration);
+                       newConfiguration = NULL;
+               }
+       }
+
+       ok = SCNetworkInterfaceSetConfiguration(interface, newConfiguration);
+       if (newConfiguration != NULL) CFRelease(newConfiguration);
+
+       return ok;
+}
+
+
+#pragma mark -
+#pragma mark Media Options
+
+
 static const struct ifmedia_description ifm_subtype_shared_descriptions[] =
     IFM_SUBTYPE_SHARED_DESCRIPTIONS;
 
@@ -193,34 +502,30 @@ __createMediaDictionary(int media_options, Boolean filter)
 
        options = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
-       while (IFM_OPTIONS(media_options) != 0) {
-               val = NULL;
-               for (i = 0; !val && ifm_shared_option_descriptions[i].ifmt_string; i++) {
-                       if (IFM_OPTIONS(media_options) & ifm_shared_option_descriptions[i].ifmt_word) {
+       for (i = 0; (IFM_OPTIONS(media_options) != 0) && (ifm_shared_option_descriptions[i].ifmt_string != NULL); i++) {
+               if ((media_options & ifm_shared_option_descriptions[i].ifmt_word) != 0) {
+                       val = CFStringCreateWithCString(NULL,
+                                                       ifm_shared_option_descriptions[i].ifmt_string,
+                                                       kCFStringEncodingASCII);
+                       CFArrayAppendValue(options, val);
+                       CFRelease(val);
+
+                       media_options &= ~ifm_shared_option_descriptions[i].ifmt_word;
+               }
+       }
+
+       if (option_descriptions != NULL) {
+               for (i = 0; (IFM_OPTIONS(media_options) != 0) && (option_descriptions[i].ifmt_string != NULL); i++) {
+                       if ((media_options & option_descriptions[i].ifmt_word) != 0) {
                                val = CFStringCreateWithCString(NULL,
-                                                               ifm_shared_option_descriptions[i].ifmt_string,
+                                                               option_descriptions[i].ifmt_string,
                                                                kCFStringEncodingASCII);
-                               media_options &= ~ifm_shared_option_descriptions[i].ifmt_word;
-                               break;
-                       }
-               }
+                               CFArrayAppendValue(options, val);
+                               CFRelease(val);
 
-               if (option_descriptions != NULL) {
-                       for (i = 0; !val && option_descriptions[i].ifmt_string; i++) {
-                               if (IFM_OPTIONS(media_options) & option_descriptions[i].ifmt_word) {
-                                       val = CFStringCreateWithCString(NULL,
-                                                                       option_descriptions[i].ifmt_string,
-                                                                       kCFStringEncodingASCII);
-                                       media_options &= ~option_descriptions[i].ifmt_word;
-                                       break;
-                               }
+                               media_options &= ~option_descriptions[i].ifmt_word;
                        }
                }
-
-               if (val) {
-                       CFArrayAppendValue(options, val);
-                       CFRelease(val);
-               }
        }
 
        CFDictionaryAddValue(dict, kSCPropNetEthernetMediaOptions, options);
@@ -231,11 +536,12 @@ __createMediaDictionary(int media_options, Boolean filter)
 
 
 int
-__createMediaOptions(CFStringRef interfaceName, CFDictionaryRef media_options)
+__SCNetworkInterfaceCreateMediaOptions(SCNetworkInterfaceRef interface, CFDictionaryRef media_options)
 {
        CFIndex                                 i;
        struct ifmediareq                       *ifm;
        int                                     ifm_new = -1;
+       CFStringRef                             interfaceName;
        Boolean                                 match;
        CFIndex                                 n;
        const struct ifmedia_description        *option_descriptions    = NULL;
@@ -244,6 +550,17 @@ __createMediaOptions(CFStringRef interfaceName, CFDictionaryRef media_options)
        const struct ifmedia_description        *subtype_descriptions   = NULL;
        CFStringRef                             val;
 
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return -1;
+       }
+
+       interfaceName = SCNetworkInterfaceGetBSDName(interface);
+       if (interfaceName == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return -1;
+       }
+
        /* set type */
 
        ifm = __copyMediaList(interfaceName);
@@ -377,7 +694,6 @@ SCNetworkInterfaceCopyMediaOptions(SCNetworkInterfaceRef    interface,
 
        interfaceName = SCNetworkInterfaceGetBSDName(interface);
        if (interfaceName == NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("no interface name"));
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
@@ -530,6 +846,49 @@ SCNetworkInterfaceCopyMediaSubTypeOptions(CFArrayRef       available,
 }
 
 
+Boolean
+_SCNetworkInterfaceIsPhysicalEthernet(SCNetworkInterfaceRef interface)
+{
+       int                     i;
+       struct ifmediareq       *ifm;
+       CFStringRef             interfaceName;
+       Boolean                 realEthernet = FALSE;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       interfaceName = SCNetworkInterfaceGetBSDName(interface);
+       if (interfaceName == NULL) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       ifm = __copyMediaList(interfaceName);
+       if (ifm == NULL) {
+               return FALSE;
+       }
+       _SCErrorSet(kSCStatusOK);
+       if (IFM_TYPE(ifm->ifm_current) != IFM_ETHER) {
+               goto done;
+       }
+       if (ifm->ifm_count == 1
+           && IFM_SUBTYPE(ifm->ifm_ulist[0]) == IFM_AUTO) {
+               /* only support autoselect, not really ethernet */
+               goto done;
+       }
+       for (i = 0; i < ifm->ifm_count; i++) {
+               if ((ifm->ifm_ulist[i] & IFM_FDX) != 0) {
+                       realEthernet = TRUE;
+                       break;
+               }
+       }
+ done:
+       __freeMediaList(ifm);
+       return (realEthernet);
+}
+
 static Boolean
 __getMTULimits(char    ifr_name[IFNAMSIZ],
               int      *mtu_min,
@@ -639,22 +998,22 @@ SCNetworkInterfaceCopyMTU(SCNetworkInterfaceRef   interface,
 
        interfaceName = SCNetworkInterfaceGetBSDName(interface);
        if (interfaceName == NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("no interface name"));
-               goto done;
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
        }
 
        bzero((void *)&ifr, sizeof(ifr));
        if (_SC_cfstring_to_cstring(interfaceName, ifr.ifr_name, sizeof(ifr.ifr_name), kCFStringEncodingASCII) == NULL) {
                SCLog(TRUE, LOG_ERR, CFSTR("could not convert interface name"));
                _SCErrorSet(kSCStatusInvalidArgument);
-               goto done;
+               return FALSE;
        }
 
        sock = socket(AF_INET, SOCK_DGRAM, 0);
        if (sock == -1) {
                _SCErrorSet(errno);
                SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
-               goto done;
+               return FALSE;
        }
 
        if (ioctl(sock, SIOCGIFMTU, (caddr_t)&ifr) == -1) {
@@ -684,14 +1043,37 @@ SCNetworkInterfaceCopyMTU(SCNetworkInterfaceRef  interface,
                } else {
                        (void)__getMTULimits(ifr.ifr_name, mtu_min, mtu_max);
                }
+
+               if (mtu_min != NULL) {
+#if    IP_MSS > IPV6_MMTU
+                       if (*mtu_min < IP_MSS) {
+                               /* bump up the minimum MTU */
+                               *mtu_min = IP_MSS/*576*/;
+                       }
+#else  // IP_MSS > IPV6_MMTU
+                       if (*mtu_min < IPV6_MMTU) {
+                               /* bump up the minimum MTU */
+                               *mtu_min = IPV6_MMTU;
+                       }
+#endif // IP_MSS > IPV6_MMTU
+
+                       if ((mtu_cur != NULL) && (*mtu_min > *mtu_cur)) {
+                               /* min must be <= cur */
+                               *mtu_min = *mtu_cur;
+                       }
+
+                       if ((mtu_max != NULL) && (*mtu_min > *mtu_max)) {
+                               /* min must be <= max */
+                               *mtu_min = *mtu_max;
+                       }
+               }
        }
 
        ok = TRUE;
 
     done :
 
-       if (sock != -1) (void)close(sock);
-
+       (void)close(sock);
        return ok;
 }
 
index de4cf22338189949e76f2191500d5019983b550e..b9ff5d79915b06a2174e7e42c6f8e4f5d68fe140 100644 (file)
@@ -29,6 +29,8 @@
                </dict>
                <key>Bond</key>
                <dict/>
+               <key>Bridge</key>
+               <dict/>
                <key>Ethernet</key>
                <dict/>
                <key>FireWire</key>
@@ -44,6 +46,8 @@
                <dict/>
                <key>L2TP-IPv4</key>
                <dict/>
+               <key>Loopback</key>
+               <dict/>
                <key>Modem</key>
                <dict>
                        <key>ConnectionPersonality</key>
                <dict/>
                <key>VLAN</key>
                <dict/>
+               <key>VPN-*</key>
+               <dict>
+                       <key>DisconnectOnFastUserSwitch</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnLogout</key>
+                       <integer>1</integer>
+                       <key>DisconnectOnSleep</key>
+                       <integer>0</integer>
+                       <key>Logfile</key>
+                       <string>/var/log/ppp.log</string>
+                       <key>VerboseLogging</key>
+                       <integer>0</integer>
+               </dict>
                <key>WWAN</key>
                <dict>
                        <key>ConnectionScript</key>
                                <integer>1</integer>
                        </dict>
                </dict>
+               <key>Bridge</key>
+               <dict>
+                       <key>DNS</key>
+                       <dict/>
+                       <key>IPv4</key>
+                       <dict>
+                               <key>ConfigMethod</key>
+                               <string>DHCP</string>
+                       </dict>
+                       <key>IPv6</key>
+                       <dict>
+                               <key>ConfigMethod</key>
+                               <string>Automatic</string>
+                       </dict>
+                       <key>Proxies</key>
+                       <dict>
+                               <key>ExceptionsList</key>
+                               <array>
+                                       <string>*.local</string>
+                                       <string>169.254/16</string>
+                               </array>
+                               <key>FTPPassive</key>
+                               <integer>1</integer>
+                       </dict>
+               </dict>
                <key>Ethernet</key>
                <dict>
                        <key>DNS</key>
                </dict>
                <key>L2TP-IPv4</key>
                <dict/>
+               <key>Loopback</key>
+               <dict/>
                <key>PPP-Bluetooth</key>
                <dict>
                        <key>DNS</key>
                                <integer>1</integer>
                        </dict>
                </dict>
+               <key>VPN-*</key>
+               <dict>
+                       <key>DNS</key>
+                       <dict/>
+                       <key>IPv4</key>
+                       <dict>
+                               <key>ConfigMethod</key>
+                               <string>VPN</string>
+                       </dict>
+                       <key>IPv6</key>
+                       <dict>
+                               <key>ConfigMethod</key>
+                               <string>Automatic</string>
+                       </dict>
+                       <key>Proxies</key>
+                       <dict>
+                               <key>FTPPassive</key>
+                               <integer>1</integer>
+                       </dict>
+               </dict>
        </dict>
 </dict>
 </plist>
index 070ff01943f6b0db675a898a43b578eb97d62faf..5f92caa88ce8b2065cc5ee87158a7b6f814d72f4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -275,24 +275,36 @@ _SCCopyDescription(CFTypeRef cf, CFDictionaryRef formatOptions)
                CFMutableStringRef      nPrefix1;
                CFMutableStringRef      nPrefix2;
                CFMutableStringRef      str;
-               const void *            values_q[N_QUICK];
-               const void **           values  = values_q;
 
                str = CFStringCreateMutable(NULL, 0);
                CFStringAppendFormat(str, formatOptions, CFSTR("%@<dictionary> {"), prefix1);
 
                nElements = CFDictionaryGetCount(cf);
                if (nElements > 0) {
+                       CFMutableArrayRef       sortedKeys;
+
                        if (nElements > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) {
-                               keys   = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
-                               values = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
+                               keys = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
+                       }
+                       CFDictionaryGetKeysAndValues(cf, keys, NULL);
+
+                       sortedKeys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+                       for (i = 0; i < nElements; i++) {
+                               CFArrayAppendValue(sortedKeys, (CFStringRef)keys[i]);
                        }
-                       CFDictionaryGetKeysAndValues(cf, keys, values);
+                       CFArraySortValues(sortedKeys,
+                                         CFRangeMake(0, nElements),
+                                         (CFComparatorFunction)CFStringCompare,
+                                         NULL);
+
                        for (i = 0; i < nElements; i++) {
+                               CFStringRef             key;
                                CFStringRef             kStr;
+                               CFTypeRef               val;
                                CFStringRef             vStr;
 
-                               kStr = _SCCopyDescription((CFTypeRef)keys[i], NULL);
+                               key  = CFArrayGetValueAtIndex(sortedKeys, i);
+                               kStr = _SCCopyDescription((CFTypeRef)key, NULL);
 
                                nPrefix1 = CFStringCreateMutable(NULL, 0);
                                CFStringAppendFormat(nPrefix1,
@@ -312,16 +324,19 @@ _SCCopyDescription(CFTypeRef cf, CFDictionaryRef formatOptions)
                                CFRelease(nPrefix2);
                                CFRelease(kStr);
 
-                               vStr = _SCCopyDescription((CFTypeRef)values[i], nFormatOptions);
+                               val  = CFDictionaryGetValue(cf, key);
+                               vStr = _SCCopyDescription((CFTypeRef)val, nFormatOptions);
                                CFStringAppendFormat(str,
                                                     formatOptions,
                                                     CFSTR("\n%@"),
                                                     vStr);
                                CFRelease(vStr);
                        }
+
+                       CFRelease(sortedKeys);
+
                        if (keys != keys_q) {
                                CFAllocatorDeallocate(NULL, keys);
-                               CFAllocatorDeallocate(NULL, values);
                        }
                }
                CFStringAppendFormat(str, formatOptions, CFSTR("\n%@}"), prefix2);
@@ -459,23 +474,48 @@ void
 SCLog(Boolean condition, int level, CFStringRef formatString, ...)
 {
        va_list         formatArguments;
+       va_list         formatArguments_print;
+       Boolean         log     = FALSE;
+       Boolean         print   = FALSE;
 
        if (!condition) {
                return;
        }
 
-       va_start(formatArguments, formatString);
+       /*
+        * Note: The following are the expected values for _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
+        */
+
        if (_sc_log > 0) {
+               log = TRUE;             // log requested
+               va_start(formatArguments, formatString);
+
+               if (_sc_log > 1) {
+                       print = TRUE;   // log AND print requested
+                       va_copy(formatArguments_print, formatArguments);
+               }
+       } else {
+               print = TRUE;           // print requested
+               va_start(formatArguments_print, formatString);
+       }
+
+       if (log) {
                __SCLog(NULL, NULL, level, formatString, formatArguments);
+               va_end(formatArguments);
        }
-       if (_sc_log != 1) {
+
+       if (print) {
                __SCPrint((LOG_PRI(level) > LOG_NOTICE) ? stderr : stdout,
                          formatString,
-                         formatArguments,
+                         formatArguments_print,
                          (_sc_log > 0),        // trace
                          TRUE);                // add newline
+               va_end(formatArguments_print);
        }
-       va_end(formatArguments);
 
        return;
 }
@@ -485,22 +525,47 @@ void
 SCLOG(aslclient asl, aslmsg msg, int level, CFStringRef formatString, ...)
 {
        va_list         formatArguments;
+       va_list         formatArguments_print;
+       Boolean         log     = FALSE;
+       Boolean         print   = FALSE;
+
+       /*
+        * Note: The following are the expected values for _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
+        */
 
-       va_start(formatArguments, formatString);
        if (_sc_log > 0) {
+               log = TRUE;             // log requested
+               va_start(formatArguments, formatString);
+
+               if (_sc_log > 1) {
+                       print = TRUE;   // log AND print requested
+                       va_copy(formatArguments_print, formatArguments);
+               }
+       } else {
+               print = TRUE;           // print requested
+               va_start(formatArguments_print, formatString);
+       }
+
+       if (log) {
                __SCLog(asl, msg, level, formatString, formatArguments);
+               va_end(formatArguments);
        }
-       if (_sc_log != 1) {
+
+       if (print) {
                if (level < 0) {
                        level = ~level;
                }
                __SCPrint((level > ASL_LEVEL_NOTICE) ? stderr : stdout,
                          formatString,
-                         formatArguments,
+                         formatArguments_print,
                          (_sc_log > 0),        // trace
                          TRUE);                // add newline
+               va_end(formatArguments_print);
        }
-       va_end(formatArguments);
 
        return;
 }
index e22424a2f96ba97ade428342672d21c556546702..74c9bd192c5fb9a9383f5fd15b775d0304007fc8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -78,6 +78,8 @@ SCDynamicStoreAddTemporaryValue(SCDynamicStoreRef store, CFStringRef key, CFProp
                return FALSE;
        }
 
+    retry :
+
        /* send the key & data to the server */
        status = configadd_s(storePrivate->server,
                             myKeyRef,
@@ -87,12 +89,8 @@ SCDynamicStoreAddTemporaryValue(SCDynamicStoreRef store, CFStringRef key, CFProp
                             &newInstance,
                             (int *)&sc_status);
 
-       /* clean up */
-       CFRelease(utfKey);
-       CFRelease(xmlData);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -100,10 +98,18 @@ SCDynamicStoreAddTemporaryValue(SCDynamicStoreRef store, CFStringRef key, CFProp
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreAddTemporaryValue configadd_s(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       CFRelease(utfKey);
+       CFRelease(xmlData);
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
@@ -151,6 +157,8 @@ SCDynamicStoreAddValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR
                return FALSE;
        }
 
+    retry :
+
        /* send the key & data to the server */
        status = configadd(storePrivate->server,
                           myKeyRef,
@@ -160,12 +168,8 @@ SCDynamicStoreAddValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR
                           &newInstance,
                           (int *)&sc_status);
 
-       /* clean up */
-       CFRelease(utfKey);
-       CFRelease(xmlData);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -173,10 +177,18 @@ SCDynamicStoreAddValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreAddValue configadd(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       CFRelease(utfKey);
+       CFRelease(xmlData);
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
index ba8673404c61b0989157006e2028d4c3ff4d981b..9ce5a19775a4a4e7cf35f53a2008143ec0d9746f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -53,8 +53,8 @@ SCDynamicStoreCopyMultiple(SCDynamicStoreRef  store,
        CFDataRef                       xmlPatterns     = NULL; /* patterns (XML serialized) */
        xmlData_t                       myPatternsRef   = NULL; /* patterns (serialized) */
        CFIndex                         myPatternsLen   = 0;
-       xmlDataOut_t                    xmlDictRef;             /* dict (serialized) */
-       mach_msg_type_number_t          xmlDictLen;
+       xmlDataOut_t                    xmlDictRef      = NULL; /* dict (serialized) */
+       mach_msg_type_number_t          xmlDictLen      = 0;
        CFDictionaryRef                 dict            = NULL; /* dict (un-serialized) */
        CFDictionaryRef                 expDict         = NULL; /* dict (un-serialized / expanded) */
        int                             sc_status;
@@ -71,7 +71,7 @@ SCDynamicStoreCopyMultiple(SCDynamicStoreRef  store,
        }
 
        /* serialize the keys */
-       if (keys) {
+       if (keys != NULL) {
                if (!_SCSerialize(keys, &xmlKeys, (void **)&myKeysRef, &myKeysLen)) {
                        _SCErrorSet(kSCStatusFailed);
                        return NULL;
@@ -79,14 +79,16 @@ SCDynamicStoreCopyMultiple(SCDynamicStoreRef        store,
        }
 
        /* serialize the patterns */
-       if (patterns) {
+       if (patterns != NULL) {
                if (!_SCSerialize(patterns, &xmlPatterns, (void **)&myPatternsRef, &myPatternsLen)) {
-                       CFRelease(xmlKeys);
+                       if (xmlKeys != NULL) CFRelease(xmlKeys);
                        _SCErrorSet(kSCStatusFailed);
                        return NULL;
                }
        }
 
+    retry :
+
        /* send the keys and patterns, fetch the associated result from the server */
        status = configget_m(storePrivate->server,
                             myKeysRef,
@@ -97,12 +99,8 @@ SCDynamicStoreCopyMultiple(SCDynamicStoreRef store,
                             &xmlDictLen,
                             (int *)&sc_status);
 
-       /* clean up */
-       if (xmlKeys)            CFRelease(xmlKeys);
-       if (xmlPatterns)        CFRelease(xmlPatterns);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -110,12 +108,22 @@ SCDynamicStoreCopyMultiple(SCDynamicStoreRef      store,
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyMultiple configget_m(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return NULL;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       if (xmlKeys != NULL)            CFRelease(xmlKeys);
+       if (xmlPatterns != NULL)        CFRelease(xmlPatterns);
+
        if (sc_status != kSCStatusOK) {
-               (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDictRef, xmlDictLen);
+               if (xmlDictRef != NULL) {
+                       (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDictRef, xmlDictLen);
+               }
                _SCErrorSet(sc_status);
                return NULL;
        }
@@ -136,14 +144,14 @@ SCDynamicStoreCopyMultiple(SCDynamicStoreRef      store,
 CFPropertyListRef
 SCDynamicStoreCopyValue(SCDynamicStoreRef store, CFStringRef key)
 {
-       SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
+       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
        kern_return_t                   status;
-       CFDataRef                       utfKey;         /* key (XML serialized) */
-       xmlData_t                       myKeyRef;       /* key (serialized) */
+       CFDataRef                       utfKey;                 /* key (XML serialized) */
+       xmlData_t                       myKeyRef;               /* key (serialized) */
        CFIndex                         myKeyLen;
-       xmlDataOut_t                    xmlDataRef;     /* data (serialized) */
-       mach_msg_type_number_t          xmlDataLen;
-       CFPropertyListRef               data;           /* data (un-serialized) */
+       xmlDataOut_t                    xmlDataRef      = NULL; /* data (serialized) */
+       mach_msg_type_number_t          xmlDataLen      = 0;
+       CFPropertyListRef               data;                   /* data (un-serialized) */
        int                             newInstance;
        int                             sc_status;
 
@@ -164,6 +172,8 @@ SCDynamicStoreCopyValue(SCDynamicStoreRef store, CFStringRef key)
                return NULL;
        }
 
+    retry :
+
        /* send the key & fetch the associated data from the server */
        status = configget(storePrivate->server,
                           myKeyRef,
@@ -173,11 +183,8 @@ SCDynamicStoreCopyValue(SCDynamicStoreRef store, CFStringRef key)
                           &newInstance,
                           (int *)&sc_status);
 
-       /* clean up */
-       CFRelease(utfKey);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -185,12 +192,21 @@ SCDynamicStoreCopyValue(SCDynamicStoreRef store, CFStringRef key)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyValue configget(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return NULL;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       CFRelease(utfKey);
+
        if (sc_status != kSCStatusOK) {
-               (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
+               if (xmlDataRef != NULL) {
+                       (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
+               }
                _SCErrorSet(sc_status);
                return NULL;
        }
index a2eb4ccafbae64d18048cdd565cf10cec08b73bb..26349cc56939c53486950121d3b1c5fc18ae4923 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2005, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -50,12 +50,17 @@ SCDynamicStoreKeyCreate(CFAllocatorRef      allocator,
                        CFStringRef     fmt,
                        ...)
 {
-       va_list args;
+       va_list         args;
+       CFStringRef     result;
+
        va_start(args, fmt);
-       return (CFStringCreateWithFormatAndArguments(allocator,
-                                                    NULL,
-                                                    fmt,
-                                                    args));
+       result = CFStringCreateWithFormatAndArguments(allocator,
+                                                     NULL,
+                                                     fmt,
+                                                     args);
+       va_end(args);
+
+       return result;
 }
 
 CFStringRef
index 7659c0f244a08e28a2ef23b80d435f1335b01026..5ba13bb4b96bf7db60d4cbc3131ee77a47534adf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 CFArrayRef
 SCDynamicStoreCopyKeyList(SCDynamicStoreRef store, CFStringRef pattern)
 {
-       SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
+       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
        kern_return_t                   status;
-       CFDataRef                       utfPattern;     /* serialized pattern */
+       CFDataRef                       utfPattern;             /* serialized pattern */
        xmlData_t                       myPatternRef;
        CFIndex                         myPatternLen;
-       xmlDataOut_t                    xmlDataRef;     /* serialized data */
-       mach_msg_type_number_t          xmlDataLen;
+       xmlDataOut_t                    xmlDataRef      = NULL;         /* serialized data */
+       mach_msg_type_number_t          xmlDataLen      = 0;
        int                             sc_status;
        CFArrayRef                      allKeys;
 
@@ -69,6 +69,8 @@ SCDynamicStoreCopyKeyList(SCDynamicStoreRef store, CFStringRef pattern)
                return NULL;
        }
 
+    retry :
+
        /* send the pattern & fetch the associated data from the server */
        status = configlist(storePrivate->server,
                            myPatternRef,
@@ -78,11 +80,8 @@ SCDynamicStoreCopyKeyList(SCDynamicStoreRef store, CFStringRef pattern)
                            &xmlDataLen,
                            (int *)&sc_status);
 
-       /* clean up */
-       CFRelease(utfPattern);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -90,12 +89,21 @@ SCDynamicStoreCopyKeyList(SCDynamicStoreRef store, CFStringRef pattern)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyKeyList configlist(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return NULL;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       CFRelease(utfPattern);
+
        if (sc_status != kSCStatusOK) {
-               (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
+               if (xmlDataRef != NULL) {
+                       (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
+               }
                _SCErrorSet(sc_status);
                return NULL;
        }
index 291cb3289471fcbeedd7619ff11b1da7007ae8c5..90617fda20eb2cca24c7b37fef09863f28f0137e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -58,11 +58,13 @@ SCDynamicStoreLock(SCDynamicStoreRef store)
                return FALSE;
        }
 
+    retry :
+
        /* get the lock from the server */
        status = configlock(storePrivate->server, (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -70,8 +72,12 @@ SCDynamicStoreLock(SCDynamicStoreRef store)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreLock configlock(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
        if (sc_status != kSCStatusOK) {
index 7e587212fec455f4fcbe22ba2b8adb6e12374ab9..40b7569d11e9f8f000c4b526877c9096f392bcf7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include "SCDynamicStoreInternal.h"
 #include "config.h"            /* MiG generated file */
 
+
+static void
+addKey(CFMutableArrayRef *keysP, CFStringRef key)
+{
+       if (*keysP == NULL) {
+               *keysP = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       }
+
+       CFArrayAppendValue(*keysP, key);
+       return;
+}
+
+
 Boolean
 SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean isRegex)
 {
@@ -67,6 +80,8 @@ SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean is
                return FALSE;
        }
 
+    retry :
+
        /* send the key to the server */
        status = notifyadd(storePrivate->server,
                           myKeyRef,
@@ -74,11 +89,8 @@ SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean is
                           isRegex,
                           (int *)&sc_status);
 
-       /* clean up */
-       CFRelease(utfKey);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -86,14 +98,26 @@ SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean is
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreAddWatchedKey notifyadd(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       CFRelease(utfKey);
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
        }
 
+       if (isRegex) {
+               addKey(&storePrivate->patterns, key);
+       } else {
+               addKey(&storePrivate->keys, key);
+       }
        return TRUE;
 }
index fa290e92ad968050d05bdcbc5db9d814d223bc6c..ca0454db9372db4c6e9a004fce4bf3a8fd685852 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2008-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -52,19 +52,10 @@ SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
                return FALSE;
        }
 
-       if (storePrivate->server == MACH_PORT_NULL) {
-               /* sorry, you must have an open session to play */
-               _SCErrorSet(kSCStatusNoStoreServer);
-               return FALSE;
-       }
-
        switch (storePrivate->notifyStatus) {
                case NotifierNotRegistered :
                        /* if no notifications have been registered */
                        return TRUE;
-               case Using_NotifierInformViaRunLoop :
-                       CFRunLoopSourceInvalidate(storePrivate->rls);
-                       return TRUE;
                case Using_NotifierInformViaCallback :
                        /* invalidate and release the run loop source */
                        if (storePrivate->callbackRLS != NULL) {
@@ -84,17 +75,26 @@ SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
                        storePrivate->callbackArgument  = NULL;
                        storePrivate->callbackFunction  = NULL;
                        break;
+               case Using_NotifierInformViaRunLoop :
+                       CFRunLoopSourceInvalidate(storePrivate->rls);
+                       storePrivate->rls = NULL;
+                       return TRUE;
+               case Using_NotifierInformViaDispatch :
+                       (void) SCDynamicStoreSetDispatchQueue(store, NULL);
+                       return TRUE;
                default :
                        break;
        }
 
-       status = notifycancel(storePrivate->server, (int *)&sc_status);
-
-       /* set notifier inactive */
-       storePrivate->notifyStatus = NotifierNotRegistered;
+       if (storePrivate->server == MACH_PORT_NULL) {
+               /* sorry, you must have an open session to play */
+               sc_status = kSCStatusNoStoreServer;
+               goto done;
+       }
 
+       status = notifycancel(storePrivate->server, (int *)&sc_status);
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -102,10 +102,19 @@ SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCancel notifycancel(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if (((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED))
+                   && __SCDynamicStoreReconnect(store)) {
+                       sc_status = kSCStatusOK;
+               } else {
+                       sc_status = status;
+               }
        }
 
+    done :
+
+       /* set notifier inactive */
+       storePrivate->notifyStatus = NotifierNotRegistered;
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
index a30209199f69596fba0ec1e807c9ceeeaf451b07..bbfe5e4a6e0a86702c1aef9a88b92f018cfdfc78 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 CFArrayRef
 SCDynamicStoreCopyNotifiedKeys(SCDynamicStoreRef store)
 {
-       SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
+       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
        kern_return_t                   status;
-       xmlDataOut_t                    xmlDataRef;     /* serialized data */
-       mach_msg_type_number_t          xmlDataLen;
+       xmlDataOut_t                    xmlDataRef      = NULL; /* serialized data */
+       mach_msg_type_number_t          xmlDataLen      = 0;
        int                             sc_status;
        CFArrayRef                      allKeys;
 
@@ -60,6 +60,8 @@ SCDynamicStoreCopyNotifiedKeys(SCDynamicStoreRef store)
                return NULL;
        }
 
+    retry :
+
        /* send the key & fetch the associated data from the server */
        status = notifychanges(storePrivate->server,
                               &xmlDataRef,
@@ -67,7 +69,7 @@ SCDynamicStoreCopyNotifiedKeys(SCDynamicStoreRef store)
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -75,12 +77,18 @@ SCDynamicStoreCopyNotifiedKeys(SCDynamicStoreRef store)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyNotifiedKeys notifychanges(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return NULL;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
        if (sc_status != kSCStatusOK) {
-               (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
+               if (xmlDataRef != NULL) {
+                       (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
+               }
                _SCErrorSet(sc_status);
                return NULL;
        }
index f88afec91c2c11f9af7299c2de8c1e516af7ec6c..166c0ced1744a74a49a982ac0d1df8958c4719a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2008-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -34,9 +34,7 @@
 #include <Availability.h>
 #include <TargetConditionals.h>
 #include <sys/cdefs.h>
-#if    !TARGET_OS_IPHONE
 #include <dispatch/dispatch.h>
-#endif // !TARGET_OS_IPHONE
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 
@@ -51,8 +49,8 @@ informCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
 {
        SCDynamicStoreRef               store           = (SCDynamicStoreRef)info;
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
-       mach_msg_empty_rcv_t            *buf            = msg;
-       mach_msg_id_t                   msgid           = buf->header.msgh_id;
+       mach_no_senders_notification_t  *buf            = msg;
+       mach_msg_id_t                   msgid           = buf->not_header.msgh_id;
        SCDynamicStoreCallBack_v1       cbFunc          = storePrivate->callbackFunction;
        void                            *cbArg          = storePrivate->callbackArgument;
 
@@ -130,17 +128,17 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef            store,
                             SCDynamicStoreCallBack_v1  func,
                             void                       *arg)
 {
-       SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
-       kern_return_t                   status;
-       mach_port_t                     port;
+       CFMachPortContext               context         = { 0
+                                                         , (void *)store
+                                                         , CFRetain
+                                                         , CFRelease
+                                                         , notifyMPCopyDescription
+                                                         };
        mach_port_t                     oldNotify;
+       mach_port_t                     port;
        int                             sc_status;
-       CFMachPortContext               context = { 0
-                                                 , (void *)store
-                                                 , CFRetain
-                                                 , CFRelease
-                                                 , notifyMPCopyDescription
-                                                 };
+       kern_return_t                   status;
+       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
        if (store == NULL) {
                /* sorry, you must provide a session */
@@ -206,6 +204,8 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef              store,
                SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCallback(): oldNotify != MACH_PORT_NULL"));
        }
 
+    retry :
+
        /* Requesting notification via mach port */
        status = notifyviaport(storePrivate->server,
                               port,
@@ -213,7 +213,7 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef              store,
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -221,16 +221,17 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef            store,
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCallback notifyviaport(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
                        /* 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;
+               sc_status = status;
        }
 
        if (sc_status != kSCStatusOK) {
@@ -245,7 +246,10 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef             store,
        __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreNotifyCallback", port);
        storePrivate->callbackArgument  = arg;
        storePrivate->callbackFunction  = func;
-       storePrivate->callbackPort      = CFMachPortCreateWithPort(NULL, port, informCallback, &context, NULL);
+       storePrivate->callbackPort      = _SC_CFMachPortCreateWithPort("SCDynamicStoreNotifyCallback",
+                                                                      port,
+                                                                      informCallback,
+                                                                      &context);
        storePrivate->callbackRLS       = CFMachPortCreateRunLoopSource(NULL, storePrivate->callbackPort, 0);
        CFRunLoopAddSource(runLoop, storePrivate->callbackRLS, kCFRunLoopDefaultMode);
 
@@ -256,8 +260,8 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef              store,
 static void
 rlsCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
 {
-       mach_msg_empty_rcv_t            *buf            = msg;
-       mach_msg_id_t                   msgid           = buf->header.msgh_id;
+       mach_no_senders_notification_t  *buf            = msg;
+       mach_msg_id_t                   msgid           = buf->not_header.msgh_id;
        SCDynamicStoreRef               store           = (SCDynamicStoreRef)info;
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
@@ -273,22 +277,8 @@ rlsCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
                }
 #endif /* DEBUG */
 
-               /* invalidate the run loop source(s) */
-               if (storePrivate->callbackRLS != NULL) {
-                       CFRunLoopSourceInvalidate(storePrivate->callbackRLS);
-                       CFRelease(storePrivate->callbackRLS);
-                       storePrivate->callbackRLS = NULL;
-               }
-
-               /* invalidate port */
-               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;
+               /* re-establish notification and inform the client */
+               (void)__SCDynamicStoreReconnectNotifications(store);
        }
 
        /* signal the real runloop source */
@@ -321,13 +311,13 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode)
              (rl != NULL) ? mode : CFSTR("libdispatch"));
 #endif /* DEBUG */
 
-       if (storePrivate->rlsRefs++ == 0) {
-               CFMachPortContext       context = { 0
-                                                 , (void *)store
-                                                 , CFRetain
-                                                 , CFRelease
-                                                 , notifyMPCopyDescription
-                                                 };
+       if (storePrivate->rlList == NULL) {
+               CFMachPortContext       context         = { 0
+                                                         , (void *)store
+                                                         , CFRetain
+                                                         , CFRelease
+                                                         , notifyMPCopyDescription
+                                                         };
                mach_port_t             oldNotify;
                mach_port_t             port;
                int                     sc_status;
@@ -380,10 +370,12 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode)
                        SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule(): oldNotify != MACH_PORT_NULL"));
                }
 
+           retry :
+
                __MACH_PORT_DEBUG(TRUE, "*** rlsSchedule", port);
                status = notifyviaport(storePrivate->server, port, 0, (int *)&sc_status);
                if (status != KERN_SUCCESS) {
-                       if (status == MACH_SEND_INVALID_DEST) {
+                       if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                                /* 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 {
@@ -391,8 +383,10 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode)
                                SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule notifyviaport(): %s"), mach_error_string(status));
                        }
                        storePrivate->server = MACH_PORT_NULL;
-
-                       if (status == MACH_SEND_INVALID_DEST) {
+                       if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                               if (__SCDynamicStoreReconnect(store)) {
+                                       goto retry;
+                               }
                                /* remove the send right that we tried (but failed) to pass to the server */
                                (void) mach_port_deallocate(mach_task_self(), port);
                        }
@@ -402,28 +396,33 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode)
                        return;
                }
 
-               __MACH_PORT_DEBUG(TRUE, "*** rlsSchedule (after notifyviaport)", port);
-               storePrivate->callbackPort = CFMachPortCreateWithPort(NULL, port, rlsCallback, &context, NULL);
-               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  */
+               if (sc_status != kSCStatusOK) {
+                       /* something [else] didn't work, 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 = _SC_CFMachPortCreateWithPort("SCDynamicStore",
+                                                                         port,
+                                                                         rlsCallback,
+                                                                         &context);
                CFMachPortSetInvalidationCallBack(storePrivate->callbackPort, portInvalidate);
                storePrivate->callbackRLS = CFMachPortCreateRunLoopSource(NULL, storePrivate->callbackPort, 0);
+
+               storePrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
        }
 
        if ((rl != NULL) && (storePrivate->callbackRLS != NULL)) {
-               CFRunLoopAddSource(rl, storePrivate->callbackRLS, mode);
-               __MACH_PORT_DEBUG(TRUE, "*** rlsSchedule (after CFRunLoopAddSource)", CFMachPortGetPort(storePrivate->callbackPort));
+               if (!_SC_isScheduled(store, rl, mode, storePrivate->rlList)) {
+                       /*
+                        * if we are not already scheduled with this runLoop / runLoopMode
+                        */
+                       CFRunLoopAddSource(rl, storePrivate->callbackRLS, mode);
+                       __MACH_PORT_DEBUG(TRUE, "*** rlsSchedule (after CFRunLoopAddSource)", CFMachPortGetPort(storePrivate->callbackPort));
+               }
+
+               _SC_schedule(store, rl, mode, storePrivate->rlList);
        }
 
        return;
@@ -433,6 +432,7 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode)
 static void
 rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode)
 {
+       CFIndex                         n               = 0;
        SCDynamicStoreRef               store           = (SCDynamicStoreRef)info;
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
@@ -443,10 +443,22 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode)
 #endif /* DEBUG */
 
        if ((rl != NULL) && (storePrivate->callbackRLS != NULL)) {
-               CFRunLoopRemoveSource(rl, storePrivate->callbackRLS, mode);
+               if (_SC_unschedule(store, rl, mode, storePrivate->rlList, FALSE)) {
+                       /*
+                        * if currently scheduled on this runLoop / runLoopMode
+                        */
+                       n = CFArrayGetCount(storePrivate->rlList);
+                       if (n == 0 || !_SC_isScheduled(store, rl, mode, storePrivate->rlList)) {
+                               /*
+                                * if we are no longer scheduled to receive notifications for
+                                * this runLoop / runLoopMode
+                                */
+                               CFRunLoopRemoveSource(rl, storePrivate->callbackRLS, mode);
+                       }
+               }
        }
 
-       if (--storePrivate->rlsRefs == 0) {
+       if (n == 0) {
                int             sc_status;
                kern_return_t   status;
 
@@ -457,6 +469,9 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode)
                                  "*** rlsCancel",
                                  CFMachPortGetPort(storePrivate->callbackPort));
 
+               CFRelease(storePrivate->rlList);
+               storePrivate->rlList = NULL;
+
                if (storePrivate->callbackRLS != NULL) {
                        /* invalidate & remove the run loop source */
                        CFRunLoopSourceInvalidate(storePrivate->callbackRLS);
@@ -477,7 +492,7 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode)
                if (storePrivate->server != MACH_PORT_NULL) {
                        status = notifycancel(storePrivate->server, (int *)&sc_status);
                        if (status != KERN_SUCCESS) {
-                               if (status == MACH_SEND_INVALID_DEST) {
+                               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                                        /* 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 {
@@ -485,6 +500,9 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode)
                                        SCLog(TRUE, LOG_ERR, CFSTR("rlsCancel notifycancel(): %s"), mach_error_string(status));
                                }
                                storePrivate->server = MACH_PORT_NULL;
+                               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                                       (void) __SCDynamicStoreReconnect(store);
+                               }
                                return;
                        }
                }
@@ -509,13 +527,18 @@ rlsPerform(void *info)
 #endif /* DEBUG */
 
        changedKeys = SCDynamicStoreCopyNotifiedKeys(store);
-       if (changedKeys == NULL) {
-               /* if no changes or something happened to the server */
-               return;
-       }
-
-       if (CFArrayGetCount(changedKeys) == 0) {
-               goto done;
+       if (storePrivate->disconnectForceCallBack) {
+               storePrivate->disconnectForceCallBack = FALSE;
+               if (changedKeys == NULL) {
+                       changedKeys = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);
+               }
+       } else {
+               if (changedKeys == NULL) {
+                       /* if no changes or something happened to the server */
+                       return;
+               } else if (CFArrayGetCount(changedKeys) == 0) {
+                       goto done;
+               }
        }
 
        rlsFunction = storePrivate->rlsFunction;
@@ -545,11 +568,18 @@ rlsRetain(CFTypeRef cf)
        SCDynamicStoreRef               store           = (SCDynamicStoreRef)cf;
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
-       if (storePrivate->notifyStatus != Using_NotifierInformViaRunLoop) {
-               /* mark RLS active */
-               storePrivate->notifyStatus = Using_NotifierInformViaRunLoop;
-               /* keep a reference to the store */
-               CFRetain(store);
+       switch (storePrivate->notifyStatus) {
+               case NotifierNotRegistered :
+                       /* mark RLS active */
+                       storePrivate->notifyStatus = Using_NotifierInformViaRunLoop;
+                       /* keep a reference to the store */
+                       CFRetain(store);
+                       break;
+               case Using_NotifierInformViaRunLoop :
+                       break;
+               default :
+                       SCLog(TRUE, LOG_ERR, CFSTR("rlsRetain() error: notifyStatus=%d"), storePrivate->notifyStatus);
+                       break;
        }
 
        return cf;
@@ -562,12 +592,21 @@ rlsRelease(CFTypeRef cf)
        SCDynamicStoreRef               store           = (SCDynamicStoreRef)cf;
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
-       /* mark RLS inactive */
-       storePrivate->notifyStatus = NotifierNotRegistered;
-       storePrivate->rls = NULL;
+       switch (storePrivate->notifyStatus) {
+               case NotifierNotRegistered :
+                       break;
+               case Using_NotifierInformViaRunLoop :
+                       /* mark RLS inactive */
+                       storePrivate->notifyStatus = NotifierNotRegistered;
+                       storePrivate->rls = NULL;
 
-       /* release our reference to the store */
-       CFRelease(store);
+                       /* release our reference to the store */
+                       CFRelease(store);
+                       break;
+               default :
+                       SCLog(TRUE, LOG_ERR, CFSTR("rlsRelease() error: notifyStatus=%d"), storePrivate->notifyStatus);
+                       break;
+       }
 
        return;
 }
@@ -664,16 +703,23 @@ SCDynamicStoreCreateRunLoopSource(CFAllocatorRef  allocator,
 }
 
 
-#if    !TARGET_OS_IPHONE
 static boolean_t
 SCDynamicStoreNotifyMIGCallback(mach_msg_header_t *message, mach_msg_header_t *reply)
 {
-       SCDynamicStorePrivateRef        storePrivate;
+       mach_msg_empty_rcv_t    *buf    = (mach_msg_empty_rcv_t *)message;
+       mach_msg_id_t           msgid   = buf->header.msgh_id;
+       SCDynamicStoreRef       store;
+
+       store = dispatch_get_context(dispatch_get_current_queue());
+       if (store != NULL) {
+               SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
-       storePrivate = dispatch_get_context(dispatch_get_current_queue());
-       if (storePrivate != NULL) {
                CFRetain(storePrivate);
                dispatch_async(storePrivate->dispatchQueue, ^{
+                       if (msgid == MACH_NOTIFY_NO_SENDERS) {
+                               /* re-establish notification and inform the client */
+                               (void)__SCDynamicStoreReconnectNotifications(store);
+                       }
                        rlsPerform(storePrivate);
                        CFRelease(storePrivate);
                });
@@ -695,15 +741,15 @@ SCDynamicStoreSetDispatchQueue(SCDynamicStoreRef store, dispatch_queue_t queue)
                return FALSE;
        }
 
-       if (storePrivate->server == MACH_PORT_NULL) {
-               /* sorry, you must have an open session to play */
-               _SCErrorSet(kSCStatusNoStoreServer);
-               return FALSE;
-       }
-
        if (queue != NULL) {
                mach_port_t     mp;
 
+               if (storePrivate->server == MACH_PORT_NULL) {
+                       /* sorry, you must have an open session to play */
+                       _SCErrorSet(kSCStatusNoStoreServer);
+                       return FALSE;
+               }
+
                if ((storePrivate->dispatchQueue != NULL) || (storePrivate->rls != NULL)) {
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
@@ -725,6 +771,12 @@ SCDynamicStoreSetDispatchQueue(SCDynamicStoreRef store, dispatch_queue_t queue)
                storePrivate->dispatchQueue = queue;
                dispatch_retain(storePrivate->dispatchQueue);
 
+               if (storePrivate->callbackPort == NULL) {
+                       /* if we could not schedule the notification */
+                       _SCErrorSet(kSCStatusFailed);
+                       goto cleanup;
+               }
+
                /*
                 * create a dispatch queue for the mach notifications source, we'll use
                 * this queue's context to carry the store pointer for the callback code.
@@ -753,8 +805,13 @@ SCDynamicStoreSetDispatchQueue(SCDynamicStoreRef store, dispatch_queue_t queue)
                        goto cleanup;
                }
                dispatch_source_set_event_handler(storePrivate->callbackSource, ^{
+                       union MaxMsgSize {
+                               mach_msg_empty_rcv_t            normal;
+                               mach_no_senders_notification_t  no_senders;
+                       };
+
                        dispatch_mig_server(storePrivate->callbackSource,
-                                           sizeof(mach_msg_header_t),
+                                           sizeof(union MaxMsgSize),
                                            SCDynamicStoreNotifyMIGCallback);
                });
                dispatch_resume(storePrivate->callbackSource);
@@ -794,4 +851,3 @@ SCDynamicStoreSetDispatchQueue(SCDynamicStoreRef store, dispatch_queue_t queue)
 
        return ok;
 }
-#endif // !TARGET_OS_IPHONE
index 221181cb97add1cb3f33c25c7b79c58916962e33..f1b6f65af85df38b3ece11a5777828e083b6c4af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004, 2005, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2008-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -118,6 +118,8 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef        store,
                return FALSE;
        }
 
+    retry :
+
        status = notifyviafd(storePrivate->server,
                             un.sun_path,
                             strlen(un.sun_path),
@@ -125,7 +127,7 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef        store,
                             (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -133,6 +135,11 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef       store,
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyFileDescriptor notifyviafd(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
                _SCErrorSet(status);
                return FALSE;
        }
index 9e6a5320da114e733d5a2374f9d24c37ccbe204b..4d0f1456816ba4026c8e0ccb0103b02802b7d123 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -113,13 +113,15 @@ SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier,
                SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort(): oldNotify != MACH_PORT_NULL"));
        }
 
+    retry :
+
        status = notifyviaport(storePrivate->server,
                               *port,
                               identifier,
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -127,8 +129,10 @@ SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier,
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort notifyviaport(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
                        /* remove the send right that we tried (but failed) to pass to the server */
                        (void) mach_port_deallocate(mach_task_self(), *port);
                }
index 495d79b7116911296e91bd78d0a62c1b0fe57e1f..3b81fc8fb68b14bdc24b2f3a29ff58ac9002bf2b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -72,10 +72,12 @@ SCDynamicStoreNotifySignal(SCDynamicStoreRef store, pid_t pid, int sig)
                return FALSE;
        }
 
+    retry :
+
        status = notifyviasignal(storePrivate->server, task, sig, (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -83,6 +85,11 @@ SCDynamicStoreNotifySignal(SCDynamicStoreRef store, pid_t pid, int sig)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifySignal notifyviasignal(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
                _SCErrorSet(status);
                return FALSE;
        }
index 42e3cd37426ed8b0ead1add536e6f873dd9e740a..be63da6e820d10beccf0b1129c5d0e8172ab58ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include "SCDynamicStoreInternal.h"
 #include "config.h"            /* MiG generated file */
 
+static void
+removeKey(CFMutableArrayRef keys, CFStringRef key)
+{
+       CFIndex i;
+       CFIndex n;
+
+       if (keys == NULL) {
+               /* if no keys */
+               return;
+       }
+
+       n = CFArrayGetCount(keys);
+       i = CFArrayGetFirstIndexOfValue(keys, CFRangeMake(0, n), key);
+       if (i == kCFNotFound) {
+               /* if key not in list */
+       }
+
+       /* remove key from list */
+       CFArrayRemoveValueAtIndex(keys, i);
+       return;
+}
+
+
 Boolean
 SCDynamicStoreRemoveWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean isRegex)
 {
@@ -67,6 +90,8 @@ SCDynamicStoreRemoveWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean
                return FALSE;
        }
 
+    retry :
+
        /* send the key to the server */
        status = notifyremove(storePrivate->server,
                              myKeyRef,
@@ -74,11 +99,8 @@ SCDynamicStoreRemoveWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean
                              isRegex,
                              (int *)&sc_status);
 
-       /* clean up */
-       CFRelease(utfKey);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -86,14 +108,26 @@ SCDynamicStoreRemoveWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreRemoveWatchedKey notifyremove(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       CFRelease(utfKey);
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
        }
 
+       if (isRegex) {
+               removeKey(storePrivate->patterns, key);
+       } else {
+               removeKey(storePrivate->keys, key);
+       }
        return TRUE;
 }
index 9343c99f454330c9f49fce87ce4681b48a2568ac..23777fa4cf5813d5857e9727656241f3acd06b63 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -51,6 +51,7 @@ SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef   store,
        xmlData_t                       myPatternsRef   = NULL; /* patterns (serialized) */
        CFIndex                         myPatternsLen   = 0;
        int                             sc_status;
+       CFMutableArrayRef               tmp;
 
        if (store == NULL) {
                /* sorry, you must provide a session */
@@ -64,7 +65,7 @@ SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef   store,
        }
 
        /* serialize the keys */
-       if (keys) {
+       if (keys != NULL) {
                if (!_SCSerialize(keys, &xmlKeys, (void **)&myKeysRef, &myKeysLen)) {
                        _SCErrorSet(kSCStatusFailed);
                        return FALSE;
@@ -72,14 +73,16 @@ SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef store,
        }
 
        /* serialize the patterns */
-       if (patterns) {
+       if (patterns != NULL) {
                if (!_SCSerialize(patterns, &xmlPatterns, (void **)&myPatternsRef, &myPatternsLen)) {
-                       CFRelease(xmlKeys);
+                       if (xmlKeys != NULL) CFRelease(xmlKeys);
                        _SCErrorSet(kSCStatusFailed);
                        return FALSE;
                }
        }
 
+    retry :
+
        /* send the keys and patterns, fetch the associated result from the server */
        status = notifyset(storePrivate->server,
                           myKeysRef,
@@ -88,12 +91,8 @@ SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef  store,
                           myPatternsLen,
                           (int *)&sc_status);
 
-       /* clean up */
-       if (xmlKeys)            CFRelease(xmlKeys);
-       if (xmlPatterns)        CFRelease(xmlPatterns);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -101,14 +100,31 @@ SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef       store,
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetNotificationKeys notifyset(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       if (xmlKeys != NULL)            CFRelease(xmlKeys);
+       if (xmlPatterns != NULL)        CFRelease(xmlPatterns);
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
        }
 
+       /* in case we need to re-connect, save the keys/patterns */
+       tmp = (keys != NULL) ? CFArrayCreateMutableCopy(NULL, 0, keys) : NULL;
+       if (storePrivate->keys != NULL) CFRelease(storePrivate->keys);
+       storePrivate->keys = tmp;
+
+       tmp = (patterns != NULL) ? CFArrayCreateMutableCopy(NULL, 0, patterns) : NULL;
+       if (storePrivate->patterns != NULL) CFRelease(storePrivate->patterns);
+       storePrivate->patterns = tmp;
+
        return TRUE;
 }
index 8b654a2a36bdead98eae5e98f2d602937588c891..707fc823d79c64d85da99f0604069a2eb3c68b8f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004, 2006, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2006, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -138,13 +138,15 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store)
                SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait(): oldNotify != MACH_PORT_NULL"));
        }
 
+    retry :
+
        status = notifyviaport(storePrivate->server,
                               port,
                               0,
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -152,16 +154,17 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait notifyviaport(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
                        /* 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;
+               sc_status = status;
        }
 
        if (sc_status != kSCStatusOK) {
@@ -201,7 +204,7 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store)
                              (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -209,14 +212,21 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store)
                        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;
+               if (((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) &&
+                   __SCDynamicStoreReconnect(store)) {
+                       sc_status = kSCStatusOK;
+               } else {
+                       sc_status = status;
+               }
        }
 
+       /* remove our receive right  */
        (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE , -1);
 
+       if (sc_status != kSCStatusOK) {
+               _SCErrorSet(sc_status);
+               return FALSE;
+       }
+
        return TRUE;
 }
index 72f23b93b7568f36a36b67aa6a8e23b5403dd549..36394bf1616a2aefc282d9c97513f558ec879ad7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -65,17 +65,16 @@ SCDynamicStoreNotifyValue(SCDynamicStoreRef store,
                return FALSE;
        }
 
+    retry :
+
        /* send the key to the server */
        status = confignotify(storePrivate->server,
                              myKeyRef,
                              myKeyLen,
                              (int *)&sc_status);
 
-       /* clean up */
-       CFRelease(utfKey);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -83,10 +82,17 @@ SCDynamicStoreNotifyValue(SCDynamicStoreRef store,
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyValue confignotify(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       CFRelease(utfKey);
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
index 77db1bb00fcedc5ffbfb3d1dbae1fbebbd927b8d..f21d49c607fe84ca81ced45aa5e9abb8cc05bb77 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2008-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * - initial revision
  */
 
+#include <TargetConditionals.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <servers/bootstrap.h>
+#include <bootstrap_priv.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
@@ -49,6 +51,18 @@ static pthread_mutex_t       _sc_lock        = PTHREAD_MUTEX_INITIALIZER;
 static mach_port_t     _sc_server      = MACH_PORT_NULL;
 
 
+static const char      *notifyType[] = {
+       "",
+       "wait",
+       "inform w/callback",
+       "inform w/mach port",
+       "inform w/fd",
+       "inform w/signal",
+       "inform w/runLoop",
+       "inform w/dispatch"
+};
+
+
 static CFStringRef
 __SCDynamicStoreCopyDescription(CFTypeRef cf) {
        CFAllocatorRef                  allocator       = CFGetAllocator(cf);
@@ -65,6 +79,9 @@ __SCDynamicStoreCopyDescription(CFTypeRef cf) {
        if (storePrivate->locked) {
                CFStringAppendFormat(result, NULL, CFSTR(", locked"));
        }
+       if (storePrivate->disconnectFunction != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", disconnect = %p"), storePrivate->disconnectFunction);
+       }
        switch (storePrivate->notifyStatus) {
                case Using_NotifierWait :
                        CFStringAppendFormat(result, NULL, CFSTR(", waiting for a notification"));
@@ -85,7 +102,6 @@ __SCDynamicStoreCopyDescription(CFTypeRef cf) {
                                CFStringAppendFormat(result, NULL, CFSTR(" {callout = %p"), storePrivate->rlsFunction);
                                CFStringAppendFormat(result, NULL, CFSTR(", info = %p"), storePrivate->rlsContext.info);
                                CFStringAppendFormat(result, NULL, CFSTR(", rls = %p"), storePrivate->rls);
-                               CFStringAppendFormat(result, NULL, CFSTR(", refs = %d"), storePrivate->rlsRefs);
                        } else {
                                CFStringAppendFormat(result, NULL, CFSTR(", mach port/callback notifications"));
                                CFStringAppendFormat(result, NULL, CFSTR(" {callout = %p"), storePrivate->callbackFunction);
@@ -150,8 +166,12 @@ __SCDynamicStoreDeallocate(CFTypeRef cf)
        }
 
        /* release any keys being watched */
-       CFRelease(storePrivate->keys);
-       CFRelease(storePrivate->patterns);
+       if (storePrivate->keys != NULL) CFRelease(storePrivate->keys);
+       if (storePrivate->patterns != NULL) CFRelease(storePrivate->patterns);
+
+       /* release any client info */
+       if (storePrivate->name != NULL) CFRelease(storePrivate->name);
+       if (storePrivate->options != NULL) CFRelease(storePrivate->options);
 
        return;
 }
@@ -235,11 +255,23 @@ __SCDynamicStoreServerPort(kern_return_t *status)
                server_name = SCD_SERVER;
        }
 
+#ifdef BOOTSTRAP_PRIVILEGED_SERVER
+       *status = bootstrap_look_up2(bootstrap_port,
+                                    server_name,
+                                    &server,
+                                    0,
+                                    BOOTSTRAP_PRIVILEGED_SERVER);
+#else  // BOOTSTRAP_PRIVILEGED_SERVER
        *status = bootstrap_look_up(bootstrap_port, server_name, &server);
+#endif // BOOTSTRAP_PRIVILEGED_SERVER
+
        switch (*status) {
                case BOOTSTRAP_SUCCESS :
                        /* service currently registered, "a good thing" (tm) */
                        return server;
+               case BOOTSTRAP_NOT_PRIVILEGED :
+                       /* the service is not privileged */
+                       break;
                case BOOTSTRAP_UNKNOWN_SERVICE :
                        /* service not currently registered, try again later */
                        break;
@@ -262,7 +294,6 @@ __SCDynamicStoreCreatePrivate(CFAllocatorRef                allocator,
                             SCDynamicStoreCallBack     callout,
                             SCDynamicStoreContext      *context)
 {
-       int                             sc_status       = kSCStatusOK;
        uint32_t                        size;
        SCDynamicStorePrivateRef        storePrivate;
 
@@ -281,6 +312,10 @@ __SCDynamicStoreCreatePrivate(CFAllocatorRef               allocator,
                return NULL;
        }
 
+       /* client side of the "configd" session */
+       storePrivate->name                              = NULL;
+       storePrivate->options                           = NULL;
+
        /* server side of the "configd" session */
        storePrivate->server                            = MACH_PORT_NULL;
 
@@ -292,7 +327,7 @@ __SCDynamicStoreCreatePrivate(CFAllocatorRef                allocator,
        storePrivate->notifyStatus                      = NotifierNotRegistered;
 
        /* "client" information associated with SCDynamicStoreCreateRunLoopSource() */
-       storePrivate->rlsRefs                           = 0;
+       storePrivate->rlList                            = NULL;
        storePrivate->rls                               = NULL;
        storePrivate->rlsFunction                       = callout;
        storePrivate->rlsContext.info                   = NULL;
@@ -312,9 +347,18 @@ __SCDynamicStoreCreatePrivate(CFAllocatorRef               allocator,
        storePrivate->callbackPort                      = NULL;
        storePrivate->callbackRLS                       = NULL;
 
+       /* "client" information associated with SCDynamicStoreSetDispatchQueue() */
+       storePrivate->dispatchQueue                     = NULL;
+       storePrivate->callbackSource                    = NULL;
+       storePrivate->callbackQueue                     = NULL;
+
+       /* "client" information associated with SCDynamicStoreSetDisconnectCallBack() */
+       storePrivate->disconnectFunction                = NULL;
+       storePrivate->disconnectForceCallBack           = FALSE;
+
        /* "server" information associated with SCDynamicStoreSetNotificationKeys() */
-       storePrivate->keys                              = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
-       storePrivate->patterns                          = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+       storePrivate->keys                              = NULL;
+       storePrivate->patterns                          = NULL;
 
        /* "server" information associated with SCDynamicStoreNotifyMachPort(); */
        storePrivate->notifyPort                        = MACH_PORT_NULL;
@@ -328,64 +372,31 @@ __SCDynamicStoreCreatePrivate(CFAllocatorRef              allocator,
        storePrivate->notifySignal                      = 0;
        storePrivate->notifySignalTask                  = TASK_NULL;
 
-       if (sc_status != kSCStatusOK) {
-               _SCErrorSet(sc_status);
-               CFRelease(storePrivate);
-               storePrivate = NULL;
-       }
-
        return storePrivate;
 }
 
 
-const CFStringRef      kSCDynamicStoreUseSessionKeys   = CFSTR("UseSessionKeys");      /* CFBoolean */
-
-
-SCDynamicStoreRef
-SCDynamicStoreCreateWithOptions(CFAllocatorRef         allocator,
-                               CFStringRef             name,
-                               CFDictionaryRef         storeOptions,
-                               SCDynamicStoreCallBack  callout,
-                               SCDynamicStoreContext   *context)
+static Boolean
+__SCDynamicStoreAddSession(SCDynamicStorePrivateRef storePrivate)
 {
-       int                             sc_status       = kSCStatusFailed;
-       mach_port_t                     server;
-       kern_return_t                   status          = KERN_SUCCESS;
-       SCDynamicStorePrivateRef        storePrivate;
-       CFDataRef                       utfName;                /* serialized name */
-       xmlData_t                       myNameRef;
-       CFIndex                         myNameLen;
-       CFDataRef                       xmlOptions      = NULL; /* serialized options */
-       xmlData_t                       myOptionsRef    = NULL;
-       CFIndex                         myOptionsLen    = 0;
-
-       /*
-        * allocate and initialize a new session
-        */
-       storePrivate = __SCDynamicStoreCreatePrivate(allocator, name, callout, context);
-       if (storePrivate == NULL) {
-               return NULL;
-       }
-
-       if (_sc_bundleID != NULL) {
-               CFStringRef     fullName;
-
-               fullName = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@:%@"), _sc_bundleID, name);
-               name = fullName;
-       } else {
-               CFRetain(name);
-       }
-
-       if (!_SCSerializeString(name, &utfName, (void **)&myNameRef, &myNameLen)) {
-               CFRelease(name);
+       CFDataRef       myName;                 /* serialized name */
+       xmlData_t       myNameRef;
+       CFIndex         myNameLen;
+       CFDataRef       myOptions       = NULL; /* serialized options */
+       xmlData_t       myOptionsRef    = NULL;
+       CFIndex         myOptionsLen    = 0;
+       int             sc_status       = kSCStatusFailed;
+       mach_port_t     server;
+       kern_return_t   status          = KERN_SUCCESS;
+
+       if (!_SCSerializeString(storePrivate->name, &myName, (void **)&myNameRef, &myNameLen)) {
                goto done;
        }
-       CFRelease(name);
 
        /* serialize the options */
-       if (storeOptions != NULL) {
-               if (!_SCSerialize(storeOptions, &xmlOptions, (void **)&myOptionsRef, &myOptionsLen)) {
-                       CFRelease(utfName);
+       if (storePrivate->options != NULL) {
+               if (!_SCSerialize(storePrivate->options, &myOptions, (void **)&myOptionsRef, &myOptionsLen)) {
+                       CFRelease(myName);
                        goto done;
                }
        }
@@ -406,7 +417,7 @@ SCDynamicStoreCreateWithOptions(CFAllocatorRef              allocator,
                        }
 
                        // our [cached] server port is not valid
-                       if (status != MACH_SEND_INVALID_DEST) {
+                       if ((status != MACH_SEND_INVALID_DEST) && (status != MIG_SERVER_DIED)) {
                                // if we got an unexpected error, don't retry
                                sc_status = status;
                                break;
@@ -433,20 +444,242 @@ SCDynamicStoreCreateWithOptions(CFAllocatorRef           allocator,
                        break;
                }
        }
-       __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreCreate[WithOptions]", storePrivate->server);
+       __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreAddSession", storePrivate->server);
 
-       /* clean up */
-       CFRelease(utfName);
-       if (xmlOptions) CFRelease(xmlOptions);
+       // clean up
+       CFRelease(myName);
+       if (myOptions != NULL)  CFRelease(myOptions);
 
     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);
+       switch (sc_status) {
+               case kSCStatusOK :
+                       return TRUE;
+               case BOOTSTRAP_UNKNOWN_SERVICE :
+                       SCLog(TRUE,
+                             (status == KERN_SUCCESS) ? LOG_DEBUG : LOG_ERR,
+                             CFSTR("SCDynamicStore server not available"));
+                       break;
+               default :
+                       SCLog(TRUE,
+                             (status == KERN_SUCCESS) ? LOG_DEBUG : LOG_ERR,
+                             CFSTR("SCDynamicStoreCreateAddSession configopen(): %s"),
+                             SCErrorString(sc_status));
+                       break;
+       }
+
+       _SCErrorSet(sc_status);
+       return FALSE;
+}
+
+
+__private_extern__
+Boolean
+__SCDynamicStoreReconnect(SCDynamicStoreRef store)
+{
+       Boolean                         ok;
+       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
+
+       ok = __SCDynamicStoreAddSession(storePrivate);
+       return ok;
+}
+
+
+static void
+pushDisconnect(SCDynamicStoreRef store)
+{
+       void                                    *context_info;
+       void                                    (*context_release)(const void *);
+       SCDynamicStoreDisconnectCallBack        disconnectFunction;
+       SCDynamicStorePrivateRef                storePrivate    = (SCDynamicStorePrivateRef)store;
+
+       disconnectFunction = storePrivate->disconnectFunction;
+       if (disconnectFunction == NULL) {
+               // if no reconnect callout, push empty notification
+               storePrivate->disconnectForceCallBack = TRUE;
+               return;
+       }
+
+       if (storePrivate->rlsContext.retain != NULL) {
+               context_info    = (void *)storePrivate->rlsContext.retain(storePrivate->rlsContext.info);
+               context_release = storePrivate->rlsContext.release;
+       } else {
+               context_info    = storePrivate->rlsContext.info;
+               context_release = NULL;
+       }
+       (*disconnectFunction)(store, context_info);
+       if (context_release) {
+               context_release(context_info);
+       }
+
+       return;
+}
+
+
+__private_extern__
+Boolean
+__SCDynamicStoreReconnectNotifications(SCDynamicStoreRef store)
+{
+       dispatch_queue_t                        dispatchQueue   = NULL;
+       __SCDynamicStoreNotificationStatus      notifyStatus;
+       Boolean                                 ok              = TRUE;
+       CFArrayRef                              rlList          = NULL;
+       SCDynamicStorePrivateRef                storePrivate    = (SCDynamicStorePrivateRef)store;
+
+       // save old SCDynamicStore [notification] state
+       notifyStatus = storePrivate->notifyStatus;
+
+       // before tearing down our [old] notifications, make sure we've
+       // retained any information that will be lost when we cancel the
+       // current no-longer-valid handler
+       switch (notifyStatus) {
+               case Using_NotifierInformViaRunLoop :
+                       if (storePrivate->rlList != NULL) {
+                               rlList = CFArrayCreateCopy(NULL, storePrivate->rlList);
+                       }
+               case Using_NotifierInformViaDispatch :
+                       dispatchQueue = storePrivate->dispatchQueue;
+                       if (dispatchQueue != NULL) dispatch_retain(dispatchQueue);
+                       break;
+               default :
+                       break;
+       }
+
+#ifdef NOTNOW
+       // invalidate the run loop source(s)
+       if (storePrivate->callbackRLS != NULL) {
+               CFRunLoopSourceInvalidate(storePrivate->callbackRLS);
+               CFRelease(storePrivate->callbackRLS);
+               storePrivate->callbackRLS = NULL;
+       }
+
+       // invalidate port
+       if (storePrivate->callbackPort != NULL) {
+               __MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreReconnectNotifications w/MACH_NOTIFY_NO_SENDERS", CFMachPortGetPort(storePrivate->callbackPort));
+               CFMachPortInvalidate(storePrivate->callbackPort);
+               CFRelease(storePrivate->callbackPort);
+               storePrivate->callbackPort = NULL;
+       }
+#endif // NOTNOW
+
+       // cancel [old] notifications
+       SCDynamicStoreNotifyCancel(store);
+
+       // set notification keys & patterns
+       if ((storePrivate->keys != NULL) || (storePrivate->patterns)) {
+               ok = SCDynamicStoreSetNotificationKeys(store,
+                                                      storePrivate->keys,
+                                                      storePrivate->patterns);
+               if (!ok) {
+                       SCLog((SCError() != BOOTSTRAP_UNKNOWN_SERVICE),
+                             LOG_ERR,
+                             CFSTR("__SCDynamicStoreReconnectNotifications: SCDynamicStoreSetNotificationKeys() failed"));
+                       goto done;
+               }
+       }
+
+       switch (notifyStatus) {
+               case Using_NotifierInformViaRunLoop : {
+                       CFIndex                 i;
+                       CFIndex                 n;
+                       CFRunLoopSourceRef      rls;
+
+                       rls = SCDynamicStoreCreateRunLoopSource(NULL, store, 0);
+                       if (rls == NULL) {
+                               SCLog((SCError() != BOOTSTRAP_UNKNOWN_SERVICE),
+                                     LOG_ERR,
+                                     CFSTR("__SCDynamicStoreReconnectNotifications: SCDynamicStoreCreateRunLoopSource() failed"));
+                               ok = FALSE;
+                               break;
+                       }
+
+                       n = (rlList != NULL) ? CFArrayGetCount(rlList) : 0;
+                       for (i = 0; i < n; i += 3) {
+                               CFRunLoopRef    rl      = (CFRunLoopRef)CFArrayGetValueAtIndex(rlList, i+1);
+                               CFStringRef     rlMode  = (CFStringRef) CFArrayGetValueAtIndex(rlList, i+2);
+
+                               CFRunLoopAddSource(rl, rls, rlMode);
+                       }
+
+                       CFRelease(rls);
+                       break;
+               }
+               case Using_NotifierInformViaDispatch :
+                       ok = SCDynamicStoreSetDispatchQueue(store, dispatchQueue);
+                       if (!ok) {
+                               SCLog((SCError() != BOOTSTRAP_UNKNOWN_SERVICE),
+                                     LOG_ERR,
+                                     CFSTR("__SCDynamicStoreReconnectNotifications: SCDynamicStoreSetDispatchQueue() failed"));
+                               goto done;
+                       }
+                       break;
+
+               default :
+                       _SCErrorSet(kSCStatusFailed);
+                       ok = FALSE;
+                       break;
+       }
+
+    done :
+
+       // cleanup
+       switch (notifyStatus) {
+               case Using_NotifierInformViaRunLoop :
+                       if (rlList != NULL) CFRelease(rlList);
+                       break;
+               case Using_NotifierInformViaDispatch :
+                       if (dispatchQueue != NULL) dispatch_release(dispatchQueue);
+                       break;
+               default :
+                       break;
+       }
+
+       if (!ok) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCDynamicStore server %s, notification (%s) not restored"),
+                     (SCError() == BOOTSTRAP_UNKNOWN_SERVICE) ? "shutdown" : "failed",
+                     notifyType[notifyStatus]);
+       }
+
+       // inform the client
+       pushDisconnect(store);
+
+       return ok;
+}
+
+
+const CFStringRef      kSCDynamicStoreUseSessionKeys   = CFSTR("UseSessionKeys");      /* CFBoolean */
+
+
+SCDynamicStoreRef
+SCDynamicStoreCreateWithOptions(CFAllocatorRef         allocator,
+                               CFStringRef             name,
+                               CFDictionaryRef         storeOptions,
+                               SCDynamicStoreCallBack  callout,
+                               SCDynamicStoreContext   *context)
+{
+       Boolean                         ok;
+       SCDynamicStorePrivateRef        storePrivate;
+
+       // allocate and initialize a new session
+       storePrivate = __SCDynamicStoreCreatePrivate(allocator, name, callout, context);
+       if (storePrivate == NULL) {
+               return NULL;
+       }
+
+       // set "name"
+       if (_sc_bundleID != NULL) {
+               storePrivate->name = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@:%@"), _sc_bundleID, name);
+       } else {
+               storePrivate->name = CFRetain(name);
+       }
+
+       // set "options"
+       storePrivate->options = (storeOptions != NULL) ? CFRetain(storeOptions) : NULL;
+
+       // establish SCDynamicStore session
+       ok = __SCDynamicStoreAddSession(storePrivate);
+       if (!ok) {
                CFRelease(storePrivate);
                storePrivate = NULL;
        }
@@ -470,3 +703,19 @@ SCDynamicStoreGetTypeID(void) {
        pthread_once(&initialized, __SCDynamicStoreInitialize); /* initialize runtime */
        return __kSCDynamicStoreTypeID;
 }
+
+Boolean
+SCDynamicStoreSetDisconnectCallBack(SCDynamicStoreRef                  store,
+                                   SCDynamicStoreDisconnectCallBack    callout)
+{
+       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
+
+       if (store == NULL) {
+               /* sorry, you must provide a session */
+               _SCErrorSet(kSCStatusNoStoreSession);
+               return FALSE;
+       }
+
+       storePrivate->disconnectFunction = callout;
+       return TRUE;
+}
index 4e685b6b611f4df4a7d4385824fe6145f453bcda..8431f3c4e3620d3c7bbd6d2489e572fbbc049b57 100644 (file)
@@ -79,7 +79,7 @@ static childInfoRef   activeChildren  = NULL;
 static pthread_mutex_t lock            = PTHREAD_MUTEX_INITIALIZER;
 
 
-static inline void
+static __inline__ void
 blockSignal()
 {
        sigset_t        mask    = sigmask(SIGCHLD);
@@ -93,7 +93,7 @@ blockSignal()
 }
 
 
-static inline void
+static __inline__ void
 unblockSignal()
 {
        sigset_t        mask    = sigmask(SIGCHLD);
index d41332b4f1622c88a69f0e4ca3ce547ec9fcd48c..5a1bf29ec0561dda26ec846dc524691982fa344d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -31,6 +31,9 @@
  * - initial revision
  */
 
+//#define DO_NOT_CRASH
+//#define DO_NOT_INFORM
+
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include <execinfo.h>
 #include <libproc.h>
 #include <unistd.h>
+#include <dlfcn.h>
+
+
+#if    TARGET_OS_EMBEDDED && !TARGET_OS_EMBEDDED_OTHER && !defined(DO_NOT_INFORM)
+#include <CoreFoundation/CFUserNotification.h>
+#endif // TARGET_OS_EMBEDDED && !TARGET_OS_EMBEDDED_OTHER && !defined(DO_NOT_INFORM)
 
 #define        N_QUICK 32
 
@@ -182,7 +191,7 @@ _SC_sendMachMessage(mach_port_t port, mach_msg_id_t msg_id)
                          MACH_PORT_NULL,               /* rcv_name */
                          0,                            /* timeout */
                          MACH_PORT_NULL);              /* notify */
-       if (status == MACH_SEND_TIMED_OUT) {
+       if (status != MACH_MSG_SUCCESS) {
                mach_msg_destroy(&msg.header);
        }
 
@@ -190,6 +199,47 @@ _SC_sendMachMessage(mach_port_t port, mach_msg_id_t msg_id)
 }
 
 
+CFStringRef
+_SC_trimDomain(CFStringRef domain)
+{
+       CFIndex length;
+
+       if (!isA_CFString(domain)) {
+               return NULL;
+       }
+
+       // remove any leading/trailing dots
+       length = CFStringGetLength(domain);
+       if ((length > 0) &&
+           (CFStringFindWithOptions(domain,
+                                    CFSTR("."),
+                                    CFRangeMake(0, 1),
+                                    kCFCompareAnchored,
+                                    NULL) ||
+            CFStringFindWithOptions(domain,
+                                    CFSTR("."),
+                                    CFRangeMake(0, length),
+                                    kCFCompareAnchored|kCFCompareBackwards,
+                                    NULL))) {
+                    CFMutableStringRef trimmed;
+
+                    trimmed = CFStringCreateMutableCopy(NULL, 0, domain);
+                    CFStringTrim(trimmed, CFSTR("."));
+                    domain = (CFStringRef)trimmed;
+                    length = CFStringGetLength(domain);
+            } else {
+                    CFRetain(domain);
+            }
+
+       if (length == 0) {
+               CFRelease(domain);
+               domain = NULL;
+       }
+
+       return domain;
+}
+
+
 #pragma mark -
 #pragma mark Serialization
 
@@ -198,19 +248,17 @@ Boolean
 _SCSerialize(CFPropertyListRef obj, CFDataRef *xml, void **dataRef, CFIndex *dataLen)
 {
        CFDataRef               myXml;
-       CFWriteStreamRef        stream;
 
        if ((xml == NULL) && ((dataRef == NULL) || (dataLen == NULL))) {
                /* if not keeping track of allocated space */
                return FALSE;
        }
 
-       stream = CFWriteStreamCreateWithAllocatedBuffers(NULL, NULL);
-       CFWriteStreamOpen(stream);
-       CFPropertyListWriteToStream(obj, stream, kCFPropertyListBinaryFormat_v1_0, NULL);
-       CFWriteStreamClose(stream);
-       myXml = CFWriteStreamCopyProperty(stream, kCFStreamPropertyDataWritten);
-       CFRelease(stream);
+       myXml = CFPropertyListCreateData(NULL,
+                                        obj,
+                                        kCFPropertyListBinaryFormat_v1_0,
+                                        0,
+                                        NULL);
        if (myXml == NULL) {
                SCLog(TRUE, LOG_ERR, CFSTR("_SCSerialize() failed"));
                if (xml != NULL) {
@@ -257,16 +305,13 @@ _SCSerialize(CFPropertyListRef obj, CFDataRef *xml, void **dataRef, CFIndex *dat
 Boolean
 _SCUnserialize(CFPropertyListRef *obj, CFDataRef xml, void *dataRef, CFIndex dataLen)
 {
-       CFStringRef     xmlError;
+       CFErrorRef      error;
 
        if (xml == NULL) {
                kern_return_t   status;
 
                xml = CFDataCreateWithBytesNoCopy(NULL, (void *)dataRef, dataLen, kCFAllocatorNull);
-               *obj = CFPropertyListCreateFromXMLData(NULL,
-                                                      xml,
-                                                      kCFPropertyListImmutable,
-                                                      &xmlError);
+               *obj = CFPropertyListCreateWithData(NULL, xml, kCFPropertyListImmutable, NULL, &error);
                CFRelease(xml);
 
                status = vm_deallocate(mach_task_self(), (vm_address_t)dataRef, dataLen);
@@ -275,16 +320,13 @@ _SCUnserialize(CFPropertyListRef *obj, CFDataRef xml, void *dataRef, CFIndex dat
                        /* non-fatal???, proceed */
                }
        } else {
-               *obj = CFPropertyListCreateFromXMLData(NULL,
-                                                      xml,
-                                                      kCFPropertyListImmutable,
-                                                      &xmlError);
+               *obj = CFPropertyListCreateWithData(NULL, xml, kCFPropertyListImmutable, NULL, &error);
        }
 
        if (*obj == NULL) {
-               if (xmlError != NULL) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("_SCUnserialize(): %@"), xmlError);
-                       CFRelease(xmlError);
+               if (error != NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("_SCUnserialize(): %@"), error);
+                       CFRelease(error);
                }
                _SCErrorSet(kSCStatusFailed);
                return FALSE;
@@ -801,10 +843,11 @@ _SC_CFBundleCopyNonLocalizedString(CFBundleRef bundle, CFStringRef key, CFString
                                                             &errCode)) {
                        CFDictionaryRef table;
 
-                       table = (CFDictionaryRef)CFPropertyListCreateFromXMLData(NULL,
-                                                                                data,
-                                                                                kCFPropertyListImmutable,
-                                                                                NULL);
+                       table = CFPropertyListCreateWithData(NULL,
+                                                            data,
+                                                            kCFPropertyListImmutable,
+                                                            NULL,
+                                                            NULL);
                        if (table != NULL) {
                                if (isA_CFDictionary(table)) {
                                        str = CFDictionaryGetValue(table, key);
@@ -830,6 +873,55 @@ _SC_CFBundleCopyNonLocalizedString(CFBundleRef bundle, CFStringRef key, CFString
 }
 
 
+#pragma mark -
+#pragma mark Mach port / CFMachPort management
+
+
+CFMachPortRef
+_SC_CFMachPortCreateWithPort(const char                *portDescription,
+                                mach_port_t            portNum,
+                                CFMachPortCallBack     callout,
+                                CFMachPortContext      *context)
+{
+       CFMachPortRef   port;
+       Boolean shouldFree      = FALSE;
+
+       port = CFMachPortCreateWithPort(NULL, portNum, callout, context, &shouldFree);
+       if ((port == NULL) || shouldFree) {
+               CFStringRef     err;
+               char            *crash_info     = NULL;
+               char            name[64]        = "";
+
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("%s: CFMachPortCreateWithPort() failed , port = %p"),
+                     portDescription,
+                     portNum);
+               if (port != NULL) {
+                       err = CFStringCreateWithFormat(NULL, NULL,
+                                                      CFSTR("%s: CFMachPortCreateWithPort recycled, [old] port = %@"),
+                                                      portDescription, port);
+               } else {
+                       err = CFStringCreateWithFormat(NULL, NULL,
+                                                      CFSTR("%s: CFMachPortCreateWithPort returned NULL"),
+                                                      portDescription);
+               }
+               crash_info = _SC_cfstring_to_cstring(err, NULL, 0, kCFStringEncodingASCII);
+               CFRelease(err);
+
+               (void) proc_name(getpid(), name, sizeof(name));
+               err = CFStringCreateWithFormat(NULL,
+                                              NULL,
+                                              CFSTR("A recycled mach_port has been detected by \"%s\"."),
+                                              name);
+               _SC_crash(crash_info, CFSTR("CFMachPort error"), err);
+               CFAllocatorDeallocate(NULL, crash_info);
+               CFRelease(err);
+       }
+
+       return port;
+}
+
+
 #pragma mark -
 #pragma mark DOS encoding/codepage
 
@@ -940,7 +1032,7 @@ _SC_logMachPortStatus(void)
        mach_msg_type_number_t  pi, pn, tn;
        CFMutableStringRef      str;
 
-       SCLog(TRUE, LOG_DEBUG, CFSTR("----------"));
+       SCLog(TRUE, LOG_NOTICE, CFSTR("----------"));
 
        /* report on ALL mach ports associated with this task */
        status = mach_port_names(mach_task_self(), &ports, &pn, &types, &tn);
@@ -967,7 +1059,7 @@ _SC_logMachPortStatus(void)
                        *rp = '\0';
                        CFStringAppendFormat(str, NULL, CFSTR(" %d%s"), ports[pi], rights);
                }
-               SCLog(TRUE, LOG_DEBUG, CFSTR("Task ports (n=%d):%@"), pn, str);
+               SCLog(TRUE, LOG_NOTICE, CFSTR("Task ports (n=%d):%@"), pn, str);
                CFRelease(str);
        }
 
@@ -1018,7 +1110,7 @@ _SC_logMachPortReferences(const char *str, mach_port_t port)
 
        status = mach_port_type(mach_task_self(), port, &pt);
        if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG,
+               SCLog(TRUE, LOG_NOTICE,
                      CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_SEND): %s"),
                      buf,
                      port,
@@ -1028,7 +1120,7 @@ _SC_logMachPortReferences(const char *str, mach_port_t port)
        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,
+                       SCLog(TRUE, LOG_NOTICE,
                              CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_SEND): %s"),
                              buf,
                              port,
@@ -1041,7 +1133,7 @@ _SC_logMachPortReferences(const char *str, mach_port_t port)
 
                status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE,   &refs_recv);
                if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_DEBUG,
+                       SCLog(TRUE, LOG_NOTICE,
                              CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_RECEIVE): %s"),
                              buf,
                              port,
@@ -1055,7 +1147,7 @@ _SC_logMachPortReferences(const char *str, mach_port_t port)
                                               (mach_port_info_t)&recv_status,
                                               &count);
                if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_DEBUG,
+                       SCLog(TRUE, LOG_NOTICE,
                              CFSTR("%mach_port_get_attributes(..., %d, MACH_PORT_RECEIVE_STATUS): %s"),
                              buf,
                              port,
@@ -1066,7 +1158,7 @@ _SC_logMachPortReferences(const char *str, mach_port_t port)
        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,
+                       SCLog(TRUE, LOG_NOTICE,
                              CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_SEND_ONCE): %s"),
                              buf,
                              port,
@@ -1077,7 +1169,7 @@ _SC_logMachPortReferences(const char *str, mach_port_t port)
        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,
+                       SCLog(TRUE, LOG_NOTICE,
                              CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_PORT_SET): %s"),
                              buf,
                              port,
@@ -1088,7 +1180,7 @@ _SC_logMachPortReferences(const char *str, mach_port_t port)
        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,
+                       SCLog(TRUE, LOG_NOTICE,
                              CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_DEAD_NAME): %s"),
                              buf,
                              port,
@@ -1096,7 +1188,7 @@ _SC_logMachPortReferences(const char *str, mach_port_t port)
                }
        }
 
-       SCLog(TRUE, LOG_DEBUG,
+       SCLog(TRUE, LOG_NOTICE,
              CFSTR("%smach port 0x%x (%d): send=%d, receive=%d, send once=%d, port set=%d, dead name=%d%s%s"),
              buf,
              port,
@@ -1142,3 +1234,102 @@ _SC_copyBacktrace()
 
        return trace;
 }
+
+
+/* CrashReporter info */
+const char *__crashreporter_info__ = NULL;
+asm(".desc ___crashreporter_info__, 0x10");
+
+
+static Boolean
+_SC_SimulateCrash(const char *crash_info, CFStringRef notifyHeader, CFStringRef notifyMessage)
+{
+       static bool     (*dyfunc_SimulateCrash)(pid_t, mach_exception_data_type_t, CFStringRef) = NULL;
+       static void     *image                                                                                  = NULL;
+       Boolean ok                                                                                      = FALSE;
+
+       if ((dyfunc_SimulateCrash == NULL) && (image == NULL)) {
+               const char      *framework      = "/System/Library/PrivateFrameworks/CrashReporterSupport.framework/"
+#if    !TARGET_OS_EMBEDDED
+                                                       "Versions/A/"
+#endif // !TARGET_OS_EMBEDDED
+                                                       "CrashReporterSupport";
+               struct stat     statbuf;
+               const char      *suffix = getenv("DYLD_IMAGE_SUFFIX");
+               char            path[MAXPATHLEN];
+
+               strlcpy(path, framework, sizeof(path));
+               if (suffix) strlcat(path, suffix, sizeof(path));
+               if (0 <= stat(path, &statbuf)) {
+                       image = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
+               } else {
+                       image = dlopen(framework, RTLD_LAZY | RTLD_LOCAL);
+               }
+
+               if (image != NULL) {
+                       dyfunc_SimulateCrash = dlsym(image, "SimulateCrash");
+               } else {
+                       image = (void *)0x1;    // to ensure that we only dlopen() once
+               }
+       }
+
+       if (dyfunc_SimulateCrash != NULL) {
+               CFStringRef     str;
+
+               str = CFStringCreateWithCString(NULL, crash_info, kCFStringEncodingUTF8);
+               ok = dyfunc_SimulateCrash(getpid(), 0xbad0005cull, str);
+               CFRelease(str);
+       }
+
+#if    TARGET_OS_EMBEDDED && !TARGET_OS_EMBEDDED_OTHER && !defined(DO_NOT_INFORM)
+       if (ok) {
+               static Boolean  warned  = FALSE;
+
+               if (!warned) {
+                       notifyMessage = CFStringCreateWithFormat(NULL,
+                                                                NULL,
+                                                                CFSTR("%@\n\nPlease collect the crash report and file a Radar."),
+                                                                notifyMessage);
+                       CFUserNotificationDisplayNotice(0,
+                                                       kCFUserNotificationStopAlertLevel,
+                                                       NULL,
+                                                       NULL,
+                                                       NULL,
+                                                       notifyHeader,
+                                                       notifyMessage,
+                                                       NULL);
+                       CFRelease(notifyMessage);
+                       warned = TRUE;
+               }
+       }
+#endif // TARGET_OS_EMBEDDED && !TARGET_OS_EMBEDDED_OTHER && !defined(DO_NOT_INFORM)
+
+       return ok;
+}
+
+
+void
+_SC_crash(const char *crash_info, CFStringRef notifyHeader, CFStringRef notifyMessage)
+{
+       Boolean ok      = FALSE;
+
+       if (crash_info != NULL) {
+               __crashreporter_info__ = crash_info;
+
+               SCLog(TRUE, LOG_ERR, CFSTR("%s"), crash_info);
+       }
+
+       if (_SC_isAppleInternal()) {
+               // simulate a crash report
+               ok = _SC_SimulateCrash(crash_info, notifyHeader, notifyMessage);
+#ifndef DO_NOT_CRASH
+               if (!ok) {
+                       // if we could not simulate a crash report, crash for real
+                       __builtin_trap();
+               }
+#endif // DO_NOT_CRASH
+       }
+
+       __crashreporter_info__ = NULL;
+       return;
+}
index 1b95ae3242a1425a379bdee4bfa99fe5be7359e6..5f1230dccb854bd02db8f526a56dc9e8d7f6b7bd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -67,17 +67,16 @@ SCDynamicStoreRemoveValue(SCDynamicStoreRef store, CFStringRef key)
                return FALSE;
        }
 
+    retry :
+
        /* send the key to the server */
        status = configremove(storePrivate->server,
                              myKeyRef,
                              myKeyLen,
                              (int *)&sc_status);
 
-       /* clean up */
-       CFRelease(utfKey);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -85,10 +84,17 @@ SCDynamicStoreRemoveValue(SCDynamicStoreRef store, CFStringRef key)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreRemoveValue configremove(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       CFRelease(utfKey);
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
index 4504855833a055c4189430c484f6cec3ab208648..a0b2221714304f11d4fb0229d7392799209cd1fb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2006, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -108,6 +108,8 @@ SCDynamicStoreSetMultiple(SCDynamicStoreRef store,
                }
        }
 
+    retry :
+
        /* send the keys and patterns, fetch the associated result from the server */
        status = configset_m(storePrivate->server,
                             mySetRef,
@@ -118,13 +120,8 @@ SCDynamicStoreSetMultiple(SCDynamicStoreRef        store,
                             myNotifyLen,
                             (int *)&sc_status);
 
-       /* clean up */
-       if (xmlSet != NULL)     CFRelease(xmlSet);
-       if (xmlRemove != NULL)  CFRelease(xmlRemove);
-       if (xmlNotify != NULL)  CFRelease(xmlNotify);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -132,10 +129,19 @@ SCDynamicStoreSetMultiple(SCDynamicStoreRef       store,
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetMultiple configset_m(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       if (xmlSet != NULL)     CFRelease(xmlSet);
+       if (xmlRemove != NULL)  CFRelease(xmlRemove);
+       if (xmlNotify != NULL)  CFRelease(xmlNotify);
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
@@ -183,6 +189,8 @@ SCDynamicStoreSetValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR
                return FALSE;
        }
 
+    retry :
+
        /* send the key & data to the server, get new instance id */
        status = configset(storePrivate->server,
                           myKeyRef,
@@ -193,12 +201,8 @@ SCDynamicStoreSetValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR
                           &newInstance,
                           (int *)&sc_status);
 
-       /* clean up */
-       CFRelease(utfKey);
-       CFRelease(xmlData);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -206,10 +210,18 @@ SCDynamicStoreSetValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetValue configset(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       CFRelease(utfKey);
+       CFRelease(xmlData);
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
index d869d382c4621863bc88fd49d32a2b8f59be3068..42277908c510759345cd0a740a46f21154c25ecb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -58,10 +58,12 @@ SCDynamicStoreSnapshot(SCDynamicStoreRef store)
                return FALSE;
        }
 
+    retry :
+
        status = snapshot(storePrivate->server, (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -69,8 +71,12 @@ SCDynamicStoreSnapshot(SCDynamicStoreRef store)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSnapshot snapshot(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
        if (sc_status != kSCStatusOK) {
index f1a7027f6771afdb3fa59bf8bc529c8e7451eb92..ca7ea4ed45766ba4e1ca99ee55a5eba46113ba63 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -67,17 +67,16 @@ SCDynamicStoreTouchValue(SCDynamicStoreRef store, CFStringRef key)
                return FALSE;
        }
 
+    retry :
+
        /* send the key to the server */
        status = configtouch(storePrivate->server,
                             myKeyRef,
                             myKeyLen,
                             (int *)&sc_status);
 
-       /* clean up */
-       CFRelease(utfKey);
-
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -85,10 +84,17 @@ SCDynamicStoreTouchValue(SCDynamicStoreRef store, CFStringRef key)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreTouchValue configtouch(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+                       if (__SCDynamicStoreReconnect(store)) {
+                               goto retry;
+                       }
+               }
+               sc_status = status;
        }
 
+       /* clean up */
+       CFRelease(utfKey);
+
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
index 994d57a9a5c76cf53b31f88f9b7dac0e8af6375b..06ac770a6d7feaee3e413543e8caf741acd3cccb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -61,7 +61,7 @@ SCDynamicStoreUnlock(SCDynamicStoreRef store)
        /* (attempt to) release the servers lock */
        status = configunlock(storePrivate->server, (int *)&sc_status);
        if (status != KERN_SUCCESS) {
-               if (status == MACH_SEND_INVALID_DEST) {
+               if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
                        /* 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 {
@@ -69,8 +69,12 @@ SCDynamicStoreUnlock(SCDynamicStoreRef store)
                        SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreUnlock configunlock(): %s"), mach_error_string(status));
                }
                storePrivate->server = MACH_PORT_NULL;
-               _SCErrorSet(status);
-               return FALSE;
+               if (((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED))
+                   && __SCDynamicStoreReconnect(store)) {
+                       sc_status = kSCStatusOK;
+               } else {
+                       sc_status = status;
+               }
        }
 
        if (sc_status != kSCStatusOK) {
index 716d5dcc9ad5de40c5710ea9b2ebc11f5514bbf4..cc431f481dd1693d132f1900cb9438d8965067a4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2008-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -30,9 +30,7 @@
 #include <Availability.h>
 #include <TargetConditionals.h>
 #include <sys/cdefs.h>
-#if    !TARGET_OS_IPHONE
 #include <dispatch/dispatch.h>
-#endif // !TARGET_OS_IPHONE
 #include <CoreFoundation/CoreFoundation.h>
 
 
@@ -95,6 +93,17 @@ typedef struct {
                changes to the dynamic store is delivered.
        @param store The dynamic store session.
        @param changedKeys The list of changed keys.
+
+               The list includes any specific SCDynamicStore keys that
+               changed (add, update, remove, notify) since the last call
+               to SCDynamicStoreSetNotificationKeys or since the last
+               notification callback. The list also includes any specific
+               keys matching one of the pattern string(s) that changed.
+
+               An empty list indicates that the SCDynamicStore server
+               restarted and that any assumptions based on prior content
+               of the SCDynamicStore should be disgarded.
+
        @param info A C pointer to a user-specified block of data.
  */
 typedef void (*SCDynamicStoreCallBack) (
@@ -219,7 +228,6 @@ SCDynamicStoreCreateRunLoopSource   (
                                        CFIndex                         order
                                        )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
-#if    !TARGET_OS_IPHONE
 /*!
        @function SCDynamicStoreSetDispatchQueue
        @discussion Initiates notifications for the Notification
@@ -234,8 +242,7 @@ Boolean
 SCDynamicStoreSetDispatchQueue         (
                                        SCDynamicStoreRef               store,
                                        dispatch_queue_t                queue
-                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
-#endif // !TARGET_OS_IPHONE
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreCopyKeyList
index 2481504a53ecc7c0234c97a6946f616e9bd100e9..04dc0ffbc3a2afaac1a9b159da5cafa8dafc2e17 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004, 2006, 2009 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -27,9 +27,7 @@
 #include <Availability.h>
 #include <TargetConditionals.h>
 #include <sys/cdefs.h>
-#if    !TARGET_OS_IPHONE
 #include <dispatch/dispatch.h>
-#endif // !TARGET_OS_IPHONE
 #include <sys/types.h>
 #include <mach/mach.h>
 #include <pthread.h>
@@ -57,6 +55,10 @@ typedef struct {
        /* base CFType information */
        CFRuntimeBase                   cfBase;
 
+       /* client side of the "configd" session */
+       CFStringRef                     name;
+       CFDictionaryRef                 options;
+
        /* server side of the "configd" session */
        mach_port_t                     server;
 
@@ -68,7 +70,7 @@ typedef struct {
        __SCDynamicStoreNotificationStatus      notifyStatus;
 
        /* "client" information associated with SCDynamicStoreCreateRunLoopSource() */
-       CFIndex                         rlsRefs;
+       CFMutableArrayRef               rlList;
        CFRunLoopSourceRef              rls;
        SCDynamicStoreCallBack          rlsFunction;
        SCDynamicStoreContext           rlsContext;
@@ -79,16 +81,18 @@ 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
+
+       /* "client" information associated with SCDynamicStoreSetDisconnectCallBack() */
+       SCDynamicStoreDisconnectCallBack        disconnectFunction;
+       Boolean                                 disconnectForceCallBack;
 
        /* "server" SCDynamicStoreKeys being watched */
-       CFMutableSetRef                 keys;
-       CFMutableSetRef                 patterns;
+       CFMutableArrayRef               keys;
+       CFMutableArrayRef               patterns;
 
        /* "server" information associated with SCDynamicStoreNotifyMachPort() */
        mach_port_t                     notifyPort;
@@ -113,6 +117,12 @@ __SCDynamicStoreCreatePrivate              (CFAllocatorRef                 allocator,
                                         SCDynamicStoreCallBack         callout,
                                         SCDynamicStoreContext          *context);
 
+Boolean
+__SCDynamicStoreReconnect              (SCDynamicStoreRef              store);
+
+Boolean
+__SCDynamicStoreReconnectNotifications (SCDynamicStoreRef              store);
+
 __END_DECLS
 
 #endif /* _SCDYNAMICSTOREINTERNAL_H */
index 326cc36f34c90674ce733493b2d497437ddd79cb..1837b6ad6f65d8530e1f541e8c979961718cf093 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 /*!
        @header SCDynamicStorePrivate
+       @discussion The SCDynamicStore APIs provide access to a key-value
+               dictionary maintained by a server process.  The dictionary is
+               accessible by all processes on the system.  The APIs allow you
+               to list the current key-value pairs, add or remove key-value
+               pairs, add or change the values associated with a key, and
+               request change notifications.
+
+               The SCDynamicStore is not "persistent" (the store content
+               starts off empty and is not saved across boot).
+
+               All interaction with the SCDynamicStore [server] is via Mach
+               IPC (MiG) messages.
+
+               A client process, using the SCDynamicStoreSetNotificationKeys
+               API, specifies a list of specific keys of interest and/or a
+               list of regex(3) pattern strings that will be matched on
+               current (and future) keys in the store.  Any matched keys that
+               are added, updated, or removed will trigger a notification.
+               The notification is delivered to the monitoring session via
+               a "something has changed" Mach IPC message.  The callback
+               notification, as part of its implementation, issues a request
+               to the server to identify the specific list of changes and
+               this list is passed along as part of the callback.  Any
+               subsequent changes to the SCDynamicStore will trigger a new
+               "something has changed" Mach IPC message and an additional
+               callback.
+
+               Note: the list (array) of changed keys passed to the
+                     notification callback will be always be non-NULL
+                     and non-empty with one exception.  That exception
+                     is when the SCDynamicStore server has been restarted.
+                     In that case, if no reconnect callback was setup
+                     with the SCDynamicStoreSetReconnectCallBack API
+                     then a non-NULL but empty array will be passed.
+
+               Disconnect/reconnect considerations:
+
+               1. We don't expect the SCDynamicStore server to fail but one
+                  should always be prepared for the unexpected.
+
+               2. Processes that write to the SCDynamicStore should be
+                  prepared to repost any content when/if the server fails.
+                  A callout, registered with the SCDynamicStoreSetReconnectCallBack
+                  API, should be used to post any updates the SCDynamicStore
+                  after a failure.
+
+               3. Processes that cache SCDynamicStore content (or otherwise
+                  maintain state based on previous notifications) should be
+                  aware that all store content is lost when/if the server
+                  fails.  After handling a SCDynamicStore notification with
+                  no keys or a disconnect/reconnect callout, your code should
+                  assume that any cached content is no longer valid.
+
+               Performance considerations:
+
+               1. We recommend that any code trying to capture a snapshot of
+                  more than one SCDynamicStore key should use the SCDynamicStoreCopyMultiple
+                  API (and not make multiple calls to SCDynamicStoreCopyValue).
+
+               2. We recommend that any code making multiple (and related)
+                  changes to the SCDynamicStore should batch them into a
+                  single call using the SCDynamicStoreSetMultiple API (and
+                  not make multiple calls to SCDynamicStoreSetValue).
  */
 
 /*!
@@ -45,6 +108,18 @@ typedef boolean_t (*SCDynamicStoreCallBack_v1)      (
                                                void                    *info
                                                );
 
+/*!
+       @typedef SCDynamicStoreDisconnectCallBack
+       @discussion Type of callback function used when notification of
+               the dynamic store session being disconnected is delivered.
+       @param store The dynamic store session.
+       @param info A C pointer to a user-specified block of data.
+ */
+typedef void (*SCDynamicStoreDisconnectCallBack)       (
+                                                        SCDynamicStoreRef      store,
+                                                        void                   *info
+                                                        );
+
 
 __BEGIN_DECLS
 
@@ -237,6 +312,24 @@ SCDynamicStoreNotifyWait           (SCDynamicStoreRef              store);
 Boolean
 SCDynamicStoreNotifyCancel             (SCDynamicStoreRef              store);
 
+/*!
+       @function SCDynamicStoreSetDisconnectCallBack
+       @discussion Assigns a callback to a SCDynamicStore session.  The function
+               is called when the session has been disconnected.  The callback
+               should be established before a client writes any content to the
+               SCDynamicStore to ensure that the information can be re-posted
+               when/if a disconnect is detected.
+       @param store A reference to the dynamic store session.
+       @param callout The function to be called when the session was disconnected.
+               If NULL, the current callback is removed.
+       @result Returns TRUE on success, FALSE on failure.
+ */
+Boolean
+SCDynamicStoreSetDisconnectCallBack    (
+                                        SCDynamicStoreRef                      store,
+                                        SCDynamicStoreDisconnectCallBack       callout
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
+
 Boolean
 SCDynamicStoreSnapshot                 (SCDynamicStoreRef              store);
 
index 5704408483704fa5179262d3a37e9dcd57fcdbfc..06f71cdc1b8b10f3605ce8d0ceed3643b5d7a7fb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2006, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -28,6 +28,7 @@
  * - initial revision
  */
 
+#include <TargetConditionals.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
index 8e047262df6e13983e4d1806217ee21567669dbc..1e0cf1980c20c3c2e895dd6ee0acae6e134f4ed2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -154,8 +154,8 @@ SCNetworkCheckReachabilityByAddress (
                Note: this API has been deprecated but you can
                      get equivalent results with :
 <pre>
-       SCNetworkReachabiltyRef   target;
-       SCNetworkReachabiltyFlags flags = 0;
+       SCNetworkReachabilityRef   target;
+       SCNetworkReachabilityFlags flags = 0;
        Boolean                   ok;
 
        target = SCNetworkReachabilityCreateWithName(NULL, name);
index 7e20211750fb7755df88e89d27e454abbadf8782..25b99feac256f58e0cfeba87e6a9d72c58ce59f4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -75,7 +75,7 @@ extern const CFStringRef kSCNetworkInterfaceTypeBluetooth                                     __OSX_AVAILABLE_ST
 /*!
        @const kSCNetworkInterfaceTypeBond
  */
-extern const CFStringRef kSCNetworkInterfaceTypeBond                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
+extern const CFStringRef kSCNetworkInterfaceTypeBond                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_4_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeEthernet
@@ -93,7 +93,7 @@ extern const CFStringRef kSCNetworkInterfaceTypeFireWire                                      __OSX_AVAILABLE_STA
 extern const CFStringRef kSCNetworkInterfaceTypeIEEE80211                                      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);       // IEEE 802.11, AirPort
 
 /*!
- @const kSCNetworkInterfaceTypeIPSec
      @const kSCNetworkInterfaceTypeIPSec
  */
 extern const CFStringRef kSCNetworkInterfaceTypeIPSec                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
@@ -130,7 +130,7 @@ extern const CFStringRef kSCNetworkInterfaceTypeSerial                                              __OSX_AVAILABLE_STAR
 /*!
        @const kSCNetworkInterfaceTypeVLAN
  */
-extern const CFStringRef kSCNetworkInterfaceTypeVLAN                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
+extern const CFStringRef kSCNetworkInterfaceTypeVLAN                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_4_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeWWAN
@@ -172,7 +172,6 @@ typedef SCNetworkInterfaceRef SCBondInterfaceRef;
  */
 typedef const struct __SCBondStatus *          SCBondStatusRef;
 
-#if    !TARGET_OS_IPHONE
 /*!
        @enum Ethernet Bond Aggregation Status (kSCBondStatusDeviceAggregationStatus) codes
        @discussion Returned status codes.
@@ -189,22 +188,21 @@ 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
+       @const kSCBondStatusDeviceAggregationStatus
  */
-extern const CFStringRef kSCBondStatusDeviceAggregationStatus  /* CFNumber */                  __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
+extern const CFStringRef kSCBondStatusDeviceAggregationStatus  /* CFNumber */                  __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_4_0/*SPI*/);
 
 /*!
-  @const kSCBondStatusDeviceCollecting
+       @const kSCBondStatusDeviceCollecting
  */
-extern const CFStringRef kSCBondStatusDeviceCollecting         /* CFNumber (0 or 1) */         __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
+extern const CFStringRef kSCBondStatusDeviceCollecting         /* CFNumber (0 or 1) */         __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_4_0/*SPI*/);
 
 /*!
-  @const kSCBondStatusDeviceDistributing
+       @const kSCBondStatusDeviceDistributing
  */
-extern const CFStringRef kSCBondStatusDeviceDistributing       /* CFNumber (0 or 1) */         __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
+extern const CFStringRef kSCBondStatusDeviceDistributing       /* CFNumber (0 or 1) */         __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_4_0/*SPI*/);
 
 /*!
        @group Interface configuration (VLAN)
@@ -506,7 +504,7 @@ SCNetworkInterfaceCopyMediaSubTypes         (CFArrayRef                     available)      __OSX_AVAILABLE_ST
        @discussion For the provided interface configuration options and specific
                subtype, return a list of available media options.
        @param available The available options as returned by the
-               NetworkInterfaceCopyMediaOptions function.
+               SCNetworkInterfaceCopyMediaOptions function.
        @param subType The subtype
        @result An array of available media options.  Each of the available options
                is returned as an array of CFString's (e.g. <half-duplex>,
@@ -545,7 +543,6 @@ SCNetworkInterfaceCopyMTU                   (SCNetworkInterfaceRef          interface,
        @param interface The desired network interface.
        @param subtype The desired media subtype (e.g. "autoselect", "100baseTX", ...).
        @param options The desired media options (e.g. "half-duplex", "full-duplex", ...).
-               If NULL, the active options will not be returned.
        @result TRUE if the configuration was updated; FALSE if an error was encountered.
  */
 Boolean
@@ -603,7 +600,7 @@ SCNetworkInterfaceForceConfigurationRefresh (SCNetworkInterfaceRef          interface)      _
                You must release the returned value.
  */
 CFArrayRef /* of SCBondInterfaceRef's */
-SCBondInterfaceCopyAll                         (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCBondInterfaceCopyAll                         (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondInterfaceCopyAvailableMemberInterfaces
@@ -614,7 +611,7 @@ SCBondInterfaceCopyAll                              (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
-SCBondInterfaceCopyAvailableMemberInterfaces   (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCBondInterfaceCopyAvailableMemberInterfaces   (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondInterfaceCreate
@@ -624,7 +621,7 @@ SCBondInterfaceCopyAvailableMemberInterfaces        (SCPreferencesRef               prefs)          __OSX_AV
                You must release the returned value.
  */
 SCBondInterfaceRef
-SCBondInterfaceCreate                          (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCBondInterfaceCreate                          (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondInterfaceRemove
@@ -633,7 +630,7 @@ SCBondInterfaceCreate                               (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__M
        @result TRUE if the interface was removed; FALSE if an error was encountered.
  */
 Boolean
-SCBondInterfaceRemove                          (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCBondInterfaceRemove                          (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondInterfaceGetMemberInterfaces
@@ -642,7 +639,7 @@ SCBondInterfaceRemove                               (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__
        @result The list of interfaces.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
-SCBondInterfaceGetMemberInterfaces             (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCBondInterfaceGetMemberInterfaces             (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondInterfaceGetOptions
@@ -652,7 +649,7 @@ SCBondInterfaceGetMemberInterfaces          (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_
                NULL if no changes to the default configuration have been saved.
  */
 CFDictionaryRef
-SCBondInterfaceGetOptions                      (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCBondInterfaceGetOptions                      (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondInterfaceSetMemberInterfaces
@@ -664,7 +661,7 @@ SCBondInterfaceGetOptions                   (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING
 Boolean
 SCBondInterfaceSetMemberInterfaces             (SCBondInterfaceRef             bond,
                                                 CFArrayRef                     members) /* of SCNetworkInterfaceRef's */
-                                                                                               __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+                                                                                               __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondInterfaceSetLocalizedDisplayName
@@ -675,7 +672,7 @@ SCBondInterfaceSetMemberInterfaces          (SCBondInterfaceRef             bond,
  */
 Boolean
 SCBondInterfaceSetLocalizedDisplayName         (SCBondInterfaceRef             bond,
-                                                CFStringRef                    newName)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+                                                CFStringRef                    newName)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondInterfaceSetOptions
@@ -686,7 +683,7 @@ SCBondInterfaceSetLocalizedDisplayName              (SCBondInterfaceRef             bond,
  */
 Boolean
 SCBondInterfaceSetOptions                      (SCBondInterfaceRef             bond,
-                                                CFDictionaryRef                newOptions)     __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+                                                CFDictionaryRef                newOptions)     __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 #pragma mark -
 
@@ -698,14 +695,14 @@ SCBondInterfaceSetOptions                 (SCBondInterfaceRef             bond,
                You must release the returned value.
  */
 SCBondStatusRef
-SCBondInterfaceCopyStatus                      (SCBondInterfaceRef     bond)                   __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCBondInterfaceCopyStatus                      (SCBondInterfaceRef     bond)                   __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondStatusGetTypeID
        @discussion Returns the type identifier of all SCBondStatus instances.
  */
 CFTypeID
-SCBondStatusGetTypeID                          (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCBondStatusGetTypeID                          (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondStatusGetMemberInterfaces
@@ -715,7 +712,7 @@ SCBondStatusGetTypeID                               (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHON
        @result The list of interfaces.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
-SCBondStatusGetMemberInterfaces                        (SCBondStatusRef        bondStatus)             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCBondStatusGetMemberInterfaces                        (SCBondStatusRef        bondStatus)             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondStatusGetInterfaceStatus
@@ -732,7 +729,7 @@ SCBondStatusGetMemberInterfaces                     (SCBondStatusRef        bondStatus)             __OSX_AVAILABLE_
  */
 CFDictionaryRef
 SCBondStatusGetInterfaceStatus                 (SCBondStatusRef        bondStatus,
-                                                SCNetworkInterfaceRef  interface)              __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+                                                SCNetworkInterfaceRef  interface)              __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @group Interface configuration (VLAN)
@@ -748,7 +745,7 @@ SCBondStatusGetInterfaceStatus                      (SCBondStatusRef        bondStatus,
                You must release the returned value.
  */
 CFArrayRef /* of SCVLANInterfaceRef's */
-SCVLANInterfaceCopyAll                         (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCVLANInterfaceCopyAll                         (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCVLANInterfaceCopyAvailablePhysicalInterfaces
@@ -758,7 +755,7 @@ SCVLANInterfaceCopyAll                              (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
-SCVLANInterfaceCopyAvailablePhysicalInterfaces (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCVLANInterfaceCopyAvailablePhysicalInterfaces (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCVLANInterfaceCreate
@@ -774,7 +771,7 @@ SCVLANInterfaceCopyAvailablePhysicalInterfaces      (void)                                          __OSX_AVAILABLE_START
 SCVLANInterfaceRef
 SCVLANInterfaceCreate                          (SCPreferencesRef               prefs,
                                                 SCNetworkInterfaceRef          physical,
-                                                CFNumberRef                    tag)            __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+                                                CFNumberRef                    tag)            __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCVLANInterfaceRemove
@@ -783,7 +780,7 @@ SCVLANInterfaceCreate                               (SCPreferencesRef               prefs,
        @result TRUE if the interface was removed; FALSE if an error was encountered.
  */
 Boolean
-SCVLANInterfaceRemove                          (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCVLANInterfaceRemove                          (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCVLANInterfaceGetPhysicalInterface
@@ -792,7 +789,7 @@ SCVLANInterfaceRemove                               (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__
        @result The list of interfaces.
  */
 SCNetworkInterfaceRef
-SCVLANInterfaceGetPhysicalInterface            (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCVLANInterfaceGetPhysicalInterface            (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCVLANInterfaceGetTag
@@ -801,7 +798,7 @@ SCVLANInterfaceGetPhysicalInterface         (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE
        @result The tag.
  */
 CFNumberRef
-SCVLANInterfaceGetTag                          (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCVLANInterfaceGetTag                          (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCVLANInterfaceGetOptions
@@ -811,7 +808,7 @@ SCVLANInterfaceGetTag                               (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__
                NULL if no changes to the default configuration have been saved.
  */
 CFDictionaryRef
-SCVLANInterfaceGetOptions                      (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+SCVLANInterfaceGetOptions                      (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCVLANInterfaceSetPhysicalInterfaceAndTag
@@ -826,7 +823,7 @@ SCVLANInterfaceGetOptions                   (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING
 Boolean
 SCVLANInterfaceSetPhysicalInterfaceAndTag      (SCVLANInterfaceRef             vlan,
                                                 SCNetworkInterfaceRef          physical,
-                                                CFNumberRef                    tag)            __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+                                                CFNumberRef                    tag)            __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCVLANInterfaceSetLocalizedDisplayName
@@ -837,7 +834,7 @@ SCVLANInterfaceSetPhysicalInterfaceAndTag   (SCVLANInterfaceRef             vlan,
  */
 Boolean
 SCVLANInterfaceSetLocalizedDisplayName         (SCVLANInterfaceRef             vlan,
-                                                CFStringRef                    newName)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+                                                CFStringRef                    newName)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCVLANInterfaceSetOptions
@@ -848,7 +845,7 @@ SCVLANInterfaceSetLocalizedDisplayName              (SCVLANInterfaceRef             vlan,
  */
 Boolean
 SCVLANInterfaceSetOptions                      (SCVLANInterfaceRef             vlan,
-                                                CFDictionaryRef                newOptions)     __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+                                                CFDictionaryRef                newOptions)     __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 
 /* --------------------------------------------------------------------------------
index 13ba9e873f88aba231d76db6aaefd857ca95249c..088b7697fbe8ababff712c00d658f07068ca8ef3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2007, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -187,10 +187,10 @@ static CFDictionaryRef
 __copyTemplates()
 {
        CFBundleRef     bundle;
+       CFErrorRef      error           = NULL;
        Boolean         ok;
        CFDictionaryRef templates;
        CFURLRef        url;
-       CFStringRef     xmlError        = NULL;
        CFDataRef       xmlTemplates    = NULL;
 
        bundle = _SC_CFBundleGet();
@@ -210,12 +210,12 @@ __copyTemplates()
        }
 
        // convert the XML data into a property list
-       templates = CFPropertyListCreateFromXMLData(NULL, xmlTemplates, kCFPropertyListImmutable, &xmlError);
+       templates = CFPropertyListCreateWithData(NULL, xmlTemplates, kCFPropertyListImmutable, NULL, &error);
        CFRelease(xmlTemplates);
        if (templates == NULL) {
-               if (xmlError != NULL) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("could not load SCNetworkConfiguration templates: %@"), xmlError);
-                       CFRelease(xmlError);
+               if (error != NULL) {
+                       SCLog(TRUE, LOG_DEBUG, CFSTR("could not load SCNetworkConfiguration templates: %@"), error);
+                       CFRelease(error);
                }
                return NULL;
        }
@@ -253,6 +253,11 @@ __copyInterfaceTemplate(CFStringRef      interfaceType,
        } else {
                CFStringRef     expandedType;
 
+               if (CFStringFind(childInterfaceType, CFSTR("."), 0).location != kCFNotFound) {
+                       // if "vendor" type
+                       childInterfaceType = CFSTR("*");
+               }
+
                expandedType = CFStringCreateWithFormat(NULL,
                                                        NULL,
                                                        CFSTR("%@-%@"),
@@ -300,6 +305,11 @@ __copyProtocolTemplate(CFStringRef      interfaceType,
        } else {
                CFStringRef     expandedType;
 
+               if (CFStringFind(childInterfaceType, CFSTR("."), 0).location != kCFNotFound) {
+                       // if "vendor" type
+                       childInterfaceType = CFSTR("*");
+               }
+
                expandedType = CFStringCreateWithFormat(NULL,
                                                        NULL,
                                                        CFSTR("%@-%@"),
index 13ff626c281f007cd30b11a9257be6aead46557e..c7272f39ac8047130b163193ce917a97d795ffc5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -133,6 +133,7 @@ typedef struct {
        CFStringRef             addressString;
        Boolean                 builtin;
        CFStringRef             configurationAction;
+       Boolean                 hidden;
        CFStringRef             location;
        CFStringRef             path;
        CFMutableDictionaryRef  overrides;
@@ -148,7 +149,6 @@ typedef struct {
        // misc
        int                     sort_order;             // sort order for this interface
 
-#if    !TARGET_OS_IPHONE
        // for BOND interfaces
        Boolean                 supportsBond;
        struct {
@@ -157,6 +157,13 @@ typedef struct {
                CFNumberRef             mode;
        } bond;
 
+       // for Bridge interfaces
+       Boolean                 supportsBridge;
+       struct {
+               CFArrayRef              interfaces;
+               CFDictionaryRef         options;
+       } bridge;
+
        // for VLAN interfaces
        Boolean                 supportsVLAN;
        struct {
@@ -164,7 +171,6 @@ typedef struct {
                CFNumberRef             tag;            // e.g. 1 <= tag <= 4094
                CFDictionaryRef         options;
        } vlan;
-#endif // !TARGET_OS_IPHONE
 
 } SCNetworkInterfacePrivate, *SCNetworkInterfacePrivateRef;
 
@@ -192,15 +198,17 @@ __SCNetworkInterfaceCreatePrivate         (CFAllocatorRef         allocator,
                                                 CFStringRef            serviceID,
                                                 io_string_t            path);
 
-#if    !TARGET_OS_IPHONE
 SCNetworkInterfacePrivateRef
 _SCBondInterfaceCreatePrivate                  (CFAllocatorRef         allocator,
                                                 CFStringRef            bond_if);
 
+SCNetworkInterfacePrivateRef
+_SCBridgeInterfaceCreatePrivate                        (CFAllocatorRef         allocator,
+                                                CFStringRef            bridge_if);
+
 SCNetworkInterfacePrivateRef
 _SCVLANInterfaceCreatePrivate                  (CFAllocatorRef         allocator,
                                                 CFStringRef            vlan_if);
-#endif // !TARGET_OS_IPHONE
 
 CFDictionaryRef
 __SCNetworkInterfaceCopyInterfaceEntity                (SCNetworkInterfaceRef  interface);
@@ -209,11 +217,22 @@ CFArrayRef
 __SCNetworkInterfaceCopyDeepConfiguration       (SCNetworkSetRef       set,
                                                 SCNetworkInterfaceRef  interface);
 
+#if    !TARGET_OS_EMBEDDED && !TARGET_IPHONE_SIMULATOR
 CFStringRef
 __SCNetworkInterfaceCopyXLocalizedDisplayName  (SCNetworkInterfaceRef  interface);
 
 CFStringRef
 __SCNetworkInterfaceCopyXNonLocalizedDisplayName(SCNetworkInterfaceRef interface);
+#endif // !TARGET_OS_EMBEDDED && !TARGET_IPHONE_SIMULATOR
+
+int
+__SCNetworkInterfaceCreateCapabilities         (SCNetworkInterfaceRef  interface,
+                                                int                    capability_base,
+                                                CFDictionaryRef        capability_options);
+
+int
+__SCNetworkInterfaceCreateMediaOptions         (SCNetworkInterfaceRef  interface,
+                                                CFDictionaryRef        media_options);
 
 CFStringRef
 __SCNetworkInterfaceGetDefaultConfigurationType        (SCNetworkInterfaceRef  interface);
@@ -221,6 +240,10 @@ __SCNetworkInterfaceGetDefaultConfigurationType    (SCNetworkInterfaceRef  interface
 CFStringRef
 __SCNetworkInterfaceGetNonLocalizedDisplayName (SCNetworkInterfaceRef  interface);
 
+Boolean
+__SCNetworkInterfaceIsMember                   (SCPreferencesRef       prefs,
+                                                SCNetworkInterfaceRef  interface);
+
 Boolean
 __SCNetworkInterfaceIsValidExtendedConfigurationType
                                                (SCNetworkInterfaceRef  interface,
@@ -229,7 +252,7 @@ __SCNetworkInterfaceIsValidExtendedConfigurationType
 
 CFDictionaryRef
 __SCNetworkInterfaceGetTemplateOverrides       (SCNetworkInterfaceRef  interface,
-                                                CFStringRef            interfaceType);
+                                                CFStringRef            overrideType);
 
 int
 __SCNetworkInterfaceOrder                      (SCNetworkInterfaceRef  interface);
@@ -245,14 +268,16 @@ __SCNetworkInterfaceSetDeepConfiguration  (SCNetworkSetRef        set,
                                                 SCNetworkInterfaceRef  interface,
                                                 CFArrayRef             configs);
 
-#if    !TARGET_OS_IPHONE
 Boolean
 __SCNetworkInterfaceSupportsVLAN               (CFStringRef            bsd_if);
 
 void
-__SCBondInterfaceListCopyMembers               (CFArrayRef             interfaces,
+__SCBondInterfaceListCollectMembers            (CFArrayRef             interfaces,
+                                                CFMutableSetRef        set);
+
+void
+__SCBridgeInterfaceListCollectMembers          (CFArrayRef             interfaces,
                                                 CFMutableSetRef        set);
-#endif // !TARGET_OS_IPHONE
 
 #pragma mark -
 #pragma mark SCNetworkProtocol configuration (internal)
@@ -271,12 +296,22 @@ __SCNetworkProtocolIsValidType                    (CFStringRef            protocolType);
 #pragma mark SCNetworkService configuration (internal)
 
 
+CFArrayRef /* of SCNetworkServiceRef's */
+__SCNetworkServiceCopyAllEnabled               (SCPreferencesRef       prefs);
+
 SCNetworkServicePrivateRef
 __SCNetworkServiceCreatePrivate                        (CFAllocatorRef         allocator,
                                                 SCPreferencesRef       prefs,
                                                 CFStringRef            serviceID,
                                                 SCNetworkInterfaceRef  interface);
 
+Boolean
+__SCNetworkServiceExistsForInterface           (CFArrayRef             services,
+                                                SCNetworkInterfaceRef  interface);
+
+CFStringRef
+__SCNetworkServiceNextName                     (SCNetworkServiceRef    service);
+
 
 #pragma mark -
 #pragma mark SCNetworkSet configuration (internal)
index 63ba8804602c3e97b63706b55ff37410a8ed83d3..3998ac96cb3833c2a6c917510be466e84d5ec5d7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 __BEGIN_DECLS
 
 
+/*!
+       @group Interface configuration
+ */
+
 #pragma mark -
-#pragma mark SCNetworkInterface configuration (SPI)
+#pragma mark SCNetworkInterface configuration (typedefs, consts)
+
+/*!
+       @const kSCNetworkInterfaceTypeBridge
+ */
+extern const CFStringRef kSCNetworkInterfaceTypeBridge                                         __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @const kSCNetworkInterfaceTypeLoopback
+ */
+extern const CFStringRef kSCNetworkInterfaceTypeLoopback                                       __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
 
+/*!
+       @const kSCNetworkInterfaceLoopback
+       @discussion A network interface representing the loopback
+               interface (lo0).
+ */
+extern const SCNetworkInterfaceRef kSCNetworkInterfaceLoopback                                 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @const kSCNetworkInterfaceTypeVPN
+ */
+extern const CFStringRef kSCNetworkInterfaceTypeVPN                                            __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @group Interface configuration (Bridge)
+ */
+
+/*!
+       @typedef SCBridgeInterfaceRef
+       @discussion This is the type of a reference to an object that represents
+               a bridge interface.
+ */
+typedef SCNetworkInterfaceRef SCBridgeInterfaceRef;
+
+#pragma mark -
+#pragma mark SCNetworkInterface configuration (SPI)
 
 /*!
        @group Interface configuration
@@ -53,7 +92,6 @@ isA_SCNetworkInterface(CFTypeRef obj)
        return (isA_CFType(obj, SCNetworkInterfaceGetTypeID()));
 }
 
-#if    !TARGET_OS_IPHONE
 static __inline__ CFTypeRef
 isA_SCBondInterface(CFTypeRef obj)
 {
@@ -73,6 +111,25 @@ isA_SCBondInterface(CFTypeRef obj)
        return obj;
 }
 
+static __inline__ CFTypeRef
+isA_SCBridgeInterface(CFTypeRef obj)
+{
+       CFStringRef     interfaceType;
+
+       if (!isA_SCNetworkInterface(obj)) {
+               // if not an SCNetworkInterface
+               return NULL;
+       }
+
+       interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
+       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBridge)) {
+               // if not a bridge
+               return NULL;
+       }
+
+       return obj;
+}
+
 static __inline__ CFTypeRef
 isA_SCVLANInterface(CFTypeRef obj)
 {
@@ -91,7 +148,6 @@ isA_SCVLANInterface(CFTypeRef obj)
 
        return obj;
 }
-#endif // !TARGET_OS_IPHONE
 
 /*!
        @function _SCNetworkInterfaceCompare
@@ -106,6 +162,16 @@ _SCNetworkInterfaceCompare                         (const void                     *val1,
                                                         const void                     *val2,
                                                         void                           *context)       __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
+/*!
+       @function _SCNetworkInterfaceCopyAllWithPreferences
+               Returns all network capable interfaces on the system.
+       @param prefs The "preferences" session.
+       @result The list of interfaces on the system.
+               You must release the returned value.
+ */
+CFArrayRef /* of SCNetworkInterfaceRef's */
+_SCNetworkInterfaceCopyAllWithPreferences              (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
+
 /*!
        @function _SCNetworkInterfaceCopySlashDevPath
        @discussion Returns the /dev pathname for the interface.
@@ -119,15 +185,16 @@ _SCNetworkInterfaceCopySlashDevPath                       (SCNetworkInterfaceRef          interface)      __OSX_A
 #define kIncludeNoVirtualInterfaces    0x0
 #define kIncludeVLANInterfaces         0x1
 #define kIncludeBondInterfaces         0x2
+#define kIncludeBridgeInterfaces       0x4
 #define kIncludeAllVirtualInterfaces   0xffffffff
 
 /*!
        @function _SCNetworkInterfaceCreateWithBSDName
        @discussion Create a new network interface associated with the provided
-               BSD interface name.  This API supports Ethhernet, FireWire, and
+               BSD interface name.  This API supports Ethernet, FireWire, and
                IEEE 802.11 interfaces.
        @param bsdName The BSD interface name.
-       @param flags Indicates whether virtual (Bond, VLAN)
+       @param flags Indicates whether virtual (Bond, Bridge, VLAN)
                network interfaces should be included.
        @result A reference to the new SCNetworkInterface.
                You must release the returned value.
@@ -167,6 +234,13 @@ _SCNetworkInterfaceCreateWithIONetworkInterfaceObject      (io_object_t                    if_obj)         __
 #define        kSCNetworkInterfaceConfigurationActionValuePrompt       CFSTR("Prompt")
 #define        kSCNetworkInterfaceConfigurationActionValueConfigure    CFSTR("Configure")
 
+#define        kSCNetworkInterfaceNetworkConfigurationOverridesKey     CFSTR("NetworkConfigurationOverrides")
+#define        kSCNetworkInterfaceHiddenConfigurationKey               CFSTR("HiddenConfiguration")
+#define        kSCNetworkInterfaceHiddenPortKey                        CFSTR("HiddenPort")
+
+// IORegistry property to indicate that a [WWAN] interface is not yet ready
+#define        kSCNetworkInterfaceInitializingKey                      CFSTR("Initializing")
+
 /*!
        @function _SCNetworkInterfaceCopyInterfaceInfo
        @discussion Returns interface details
@@ -227,13 +301,31 @@ _SCNetworkInterfaceGetIOPath                              (SCNetworkInterfaceRef          interface)      __OSX_AVAILAB
 
 /*!
        @function _SCNetworkInterfaceIsBluetoothPAN
-       @discussion Identifies if a network interface is a Bluetooth PAN device.
+       @discussion Identifies if a network interface is a Bluetooth PAN (GN) 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 _SCNetworkInterfaceIsBluetoothPAN_NAP
+       @discussion Identifies if a network interface is a Bluetooth PAN-NAP device.
+       @param interface The network interface.
+       @result TRUE if the interface is a Bluetooth PAN-NAP device.
+ */
+Boolean
+_SCNetworkInterfaceIsBluetoothPAN_NAP                  (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
+
+/*!
+       @function _SCNetworkInterfaceIsBluetoothP2P
+       @discussion Identifies if a network interface is a Bluetooth P2P (PAN-U) device.
+       @param interface The network interface.
+       @result TRUE if the interface is a Bluetooth P2P device.
+ */
+Boolean
+_SCNetworkInterfaceIsBluetoothP2P                      (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
+
 /*!
        @function _SCNetworkInterfaceIsBuiltin
        @discussion Identifies if a network interface is "built-in".
@@ -244,13 +336,14 @@ Boolean
 _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).
+       @function _SCNetworkInterfaceIsHiddenConfiguration
+       @discussion Identifies if the configuration of a network interface should be
+               hidden from any user interface (e.g. the "Network" pref pane).
        @param interface The network interface.
-       @result TRUE if the interface is a tethered device.
+       @result TRUE if the interface configuration should be hidden.
  */
 Boolean
-_SCNetworkInterfaceIsTethered                          (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0);
+_SCNetworkInterfaceIsHiddenConfiguration               (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
 
 /*!
        @function _SCNetworkInterfaceIsModemV92
@@ -262,6 +355,24 @@ _SCNetworkInterfaceIsTethered                              (SCNetworkInterfaceRef          interface)      __OSX_AVAILA
 Boolean
 _SCNetworkInterfaceIsModemV92                          (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 _SCNetworkInterfaceIsPhysicalEthernet
+       @discussion Indicates whether a network interface is a real ethernet interface i.e. one with an ethernet PHY.
+       @param interface The network interface.
+       @result TRUE if the interface is a real ethernet interface.
+ */
+Boolean
+_SCNetworkInterfaceIsPhysicalEthernet                  (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
+
 /*!
        @function _SCNetworkInterfaceForceConfigurationRefresh
        @discussion Forces a configuration refresh of the
@@ -272,6 +383,41 @@ _SCNetworkInterfaceIsModemV92                              (SCNetworkInterfaceRef          interface)      __OSX_AVAILA
 Boolean
 _SCNetworkInterfaceForceConfigurationRefresh           (CFStringRef                    ifName)         __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
+/*!
+       @function SCNetworkInterfaceCopyCapability
+       @discussion For the specified network interface, returns information
+               about the currently requested capabilities, the active capabilities,
+               and the capabilities which are available.
+       @param interface The desired network interface.
+       @param capability The desired capability.
+       @result a CFTypeRef representing the current value of requested
+               capability;
+               NULL if the capability is not available for this
+               interface or if an error was encountered.
+               You must release the returned value.
+ */
+CFTypeRef
+SCNetworkInterfaceCopyCapability                       (SCNetworkInterfaceRef          interface,
+                                                        CFStringRef                    capability)     __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
+
+/*!
+       @function SCNetworkInterfaceSetCapability
+       @discussion For the specified network interface, sets the requested
+               capabilities.
+       @param interface The desired network interface.
+       @param capability The desired capability.
+       @param newValue The new requested setting for the capability;
+               NULL to restore the default setting.
+       @result TRUE if the configuration was updated; FALSE if an error was encountered.
+ */
+Boolean
+SCNetworkInterfaceSetCapability                                (SCNetworkInterfaceRef          interface,
+                                                        CFStringRef                    capability,
+                                                        CFTypeRef                      newValue)       __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
+
+#pragma mark -
+#pragma mark SCBondInterface configuration (SPIs)
+
 /*!
        @function _SCBondInterfaceCopyActive
        @discussion Returns all Ethernet Bond interfaces on the system.
@@ -279,7 +425,7 @@ _SCNetworkInterfaceForceConfigurationRefresh                (CFStringRef                    ifName)         __OSX_AVAI
                You must release the returned value.
  */
 CFArrayRef
-_SCBondInterfaceCopyActive                             (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+_SCBondInterfaceCopyActive                             (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function _SCBondInterfaceUpdateConfiguration
@@ -289,7 +435,16 @@ _SCBondInterfaceCopyActive                         (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__
                an error was encountered.
  */
 Boolean
-_SCBondInterfaceUpdateConfiguration                    (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+_SCBondInterfaceUpdateConfiguration                    (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @function SCBondInterfaceGetMode
+       @discussion Return the mode for the given bond interface.
+       @param bond The bond interface to get the mode from.
+       @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
+ */
+CFNumberRef
+SCBondInterfaceGetMode                                 (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCBondInterfaceSetMode
@@ -300,16 +455,128 @@ _SCBondInterfaceUpdateConfiguration                      (SCPreferencesRef               prefs)          __OSX_AVAILABLE
  */
 Boolean
 SCBondInterfaceSetMode                                 (SCBondInterfaceRef             bond,
-                                                        CFNumberRef                    mode)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+                                                        CFNumberRef                    mode)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
+
+#pragma mark -
+#pragma mark SCBridgeInterface configuration (SPIs)
 
 /*!
-       @function SCBondInterfaceSetMode
-       @discussion Return the mode for the given bond interface.
-       @param bond The bond interface to get the mode from.
-       @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
+       @function SCBridgeInterfaceCopyAll
+       @discussion Returns all bridge interfaces on the system.
+       @param prefs The "preferences" session.
+       @result The list of bridge interfaces on the system.
+               You must release the returned value.
  */
-CFNumberRef
-SCBondInterfaceGetMode                                 (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+CFArrayRef /* of SCBridgeInterfaceRef's */
+SCBridgeInterfaceCopyAll                               (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @function SCBridgeInterfaceCopyAvailableMemberInterfaces
+       @discussion Returns all network capable devices on the system
+               that can be added to an bridge interface.
+       @param prefs The "preferences" session.
+       @result The list of interfaces.
+               You must release the returned value.
+ */
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCBridgeInterfaceCopyAvailableMemberInterfaces         (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @function SCBridgeInterfaceCreate
+       @discussion Create a new SCBridgeInterface interface.
+       @param prefs The "preferences" session.
+       @result A reference to the new SCBridgeInterface.
+               You must release the returned value.
+ */
+SCBridgeInterfaceRef
+SCBridgeInterfaceCreate                                        (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @function SCBridgeInterfaceRemove
+       @discussion Removes the SCBridgeInterface from the configuration.
+       @param bridge The SCBridgeInterface interface.
+       @result TRUE if the interface was removed; FALSE if an error was encountered.
+ */
+Boolean
+SCBridgeInterfaceRemove                                        (SCBridgeInterfaceRef           bridge)         __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @function SCBridgeInterfaceGetMemberInterfaces
+       @discussion Returns the member interfaces for the specified bridge interface.
+       @param bridge The SCBridgeInterface interface.
+       @result The list of interfaces.
+ */
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCBridgeInterfaceGetMemberInterfaces                   (SCBridgeInterfaceRef           bridge)         __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @function SCBridgeInterfaceGetOptions
+       @discussion Returns the configuration settings associated with a bridge interface.
+       @param bridge The SCBridgeInterface interface.
+       @result The configuration settings associated with the bridge interface;
+               NULL if no changes to the default configuration have been saved.
+ */
+CFDictionaryRef
+SCBridgeInterfaceGetOptions                            (SCBridgeInterfaceRef           bridge)         __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @function SCBridgeInterfaceSetMemberInterfaces
+       @discussion Sets the member interfaces for the specified bridge interface.
+       @param bridge The SCBridgeInterface interface.
+       @param members The desired member interfaces.
+       @result TRUE if the configuration was stored; FALSE if an error was encountered.
+ */
+Boolean
+SCBridgeInterfaceSetMemberInterfaces                   (SCBridgeInterfaceRef           bridge,
+                                                        CFArrayRef                     members) /* of SCNetworkInterfaceRef's */
+                                                                                                       __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @function SCBridgeInterfaceSetLocalizedDisplayName
+       @discussion Sets the localized display name for the specified bridge interface.
+       @param bridge The SCBridgeInterface interface.
+       @param newName The new display name.
+       @result TRUE if the configuration was stored; FALSE if an error was encountered.
+ */
+Boolean
+SCBridgeInterfaceSetLocalizedDisplayName               (SCBridgeInterfaceRef           bridge,
+                                                        CFStringRef                    newName)        __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @function SCBridgeInterfaceSetOptions
+       @discussion Sets the configuration settings for the specified bridge interface.
+       @param bridge The SCBridgeInterface interface.
+       @param newOptions The new configuration settings.
+       @result TRUE if the configuration was stored; FALSE if an error was encountered.
+ */
+Boolean
+SCBridgeInterfaceSetOptions                            (SCBridgeInterfaceRef           bridge,
+                                                        CFDictionaryRef                newOptions)     __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+#pragma mark -
+
+/*!
+       @function _SCBridgeInterfaceCopyActive
+       @discussion Returns all bridge interfaces on the system.
+       @result The list of SCBridgeInterface interfaces on the system.
+               You must release the returned value.
+ */
+CFArrayRef
+_SCBridgeInterfaceCopyActive                           (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+/*!
+       @function _SCBridgeInterfaceUpdateConfiguration
+       @discussion Updates the bridge interface configuration.
+       @param prefs The "preferences" session.
+       @result TRUE if the bridge interface configuration was updated.; FALSE if the
+               an error was encountered.
+ */
+Boolean
+_SCBridgeInterfaceUpdateConfiguration                  (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
+
+
+#pragma mark -
+#pragma mark SCVLANInterface configuration (SPIs)
 
 /*!
        @function _SCVLANInterfaceCopyActive
@@ -318,7 +585,7 @@ SCBondInterfaceGetMode                                      (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(
                You must release the returned value.
  */
 CFArrayRef
-_SCVLANInterfaceCopyActive                             (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+_SCVLANInterfaceCopyActive                             (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function _SCVLANInterfaceUpdateConfiguration
@@ -328,7 +595,7 @@ _SCVLANInterfaceCopyActive                          (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__
                an error was encountered.
  */
 Boolean
-_SCVLANInterfaceUpdateConfiguration                    (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
+_SCVLANInterfaceUpdateConfiguration                    (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/);
 
 
 #pragma mark -
@@ -340,6 +607,7 @@ enum {
        kSCNetworkInterfacePasswordTypeIPSecSharedSecret,
        kSCNetworkInterfacePasswordTypeEAPOL,
        kSCNetworkInterfacePasswordTypeIPSecXAuth,
+       kSCNetworkInterfacePasswordTypeVPN,
 };
 typedef uint32_t       SCNetworkInterfacePasswordType;
 
@@ -401,6 +669,19 @@ enum {
 };
 typedef uint32_t       SCNetworkServicePrimaryRank;
 
+/*!
+       @function _SCNetworkServiceCompare
+       @discussion Compares two SCNetworkService objects.
+       @param val1 The SCNetworkService object.
+       @param val2 The SCNetworkService object.
+       @param context The service order (from SCNetworkSetGetServiceOrder).
+       @result A comparison result.
+ */
+CFComparisonResult
+_SCNetworkServiceCompare                               (const void                     *val1,
+                                                        const void                     *val2,
+                                                        void                           *context)       __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
+
 /*!
        @function _SCNetworkServiceCopyActive
        @discussion Returns the network service with the specified identifier.
@@ -446,6 +727,14 @@ Boolean
 SCNetworkServiceSetPrimaryRank                         (SCNetworkServiceRef            service,
                                                         SCNetworkServicePrimaryRank    newRank)        __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0);
 
+/*!
+       @function _SCNetworkServiceIsVPN
+       @discussion Identifies a VPN service.
+       @param service The network service.
+       @result TRUE if the service is a VPN.
+ */
+Boolean
+_SCNetworkServiceIsVPN                                 (SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
 
 #pragma mark -
 #pragma mark SCNetworkSet configuration (SPI)
@@ -503,6 +792,32 @@ Boolean
 SCNetworkSetEstablishDefaultInterfaceConfiguration     (SCNetworkSetRef                set,
                                                         SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
+/*!
+       @function SCNetworkSetCopySelectedVPNService
+       @discussion On the iPhone we only allow a single VPN network service
+               to be selected at any given time.  This API will identify
+               the selected VPN service.
+       @param set The network set.
+       @result The selected VPN service; NULL if no service has been
+               selected.
+               You must release the returned value.
+ */
+SCNetworkServiceRef
+SCNetworkSetCopySelectedVPNService                     (SCNetworkSetRef                set)            __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
+
+/*!
+       @function SCNetworkSetSetSelectedVPNService
+       @discussion On the iPhone we only allow a single VPN network service
+               to be selected at any given time.  This API should be used to
+               select a VPN service.
+       @param set The network set.
+       @param service The VPN service to be selected.
+       @result TRUE if the name was saved; FALSE if an error was encountered.
+ */
+Boolean
+SCNetworkSetSetSelectedVPNService                      (SCNetworkSetRef                set,
+                                                        SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
+
 __END_DECLS
 
 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */
index 01aeb222be7524c05bd868ae2a90e7b8e99d8860..abaefeefac1b7125f1720b8825abcdd2e2438eb0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 
+//#define DEBUG_MACH_PORT_ALLOCATIONS
+
+
 #include <Availability.h>
 #include <TargetConditionals.h>
 #include <sys/cdefs.h>
-#if    !TARGET_OS_IPHONE
 #include <dispatch/dispatch.h>
-#endif // !TARGET_OS_IPHONE
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
@@ -50,6 +51,7 @@
 #endif // !TARGET_OS_IPHONE
 
 #include <servers/bootstrap.h>
+#include <bootstrap_priv.h>
 
 #include <pthread.h>
 #include <notify.h>
@@ -61,6 +63,7 @@
 #include <sys/socket.h>
 #include <net/if.h>
 #include <mach/mach.h>
+#include <bsm/audit.h>
 
 #include <ppp/ppp_msg.h>
 #include "pppcontroller.h"
@@ -70,6 +73,8 @@
 
 static int             debug                   = 0;
 static pthread_once_t  initialized             = PTHREAD_ONCE_INIT;
+static pthread_mutex_t scnc_lock               = PTHREAD_MUTEX_INITIALIZER;
+static mach_port_t     scnc_server             = MACH_PORT_NULL;
 
 
 typedef struct {
@@ -89,6 +94,9 @@ typedef struct {
        /* ref to PPP controller for notification messages */
        CFMachPortRef                   notify_port;
 
+       /* keep track of whether we're acquired the initial status */
+       Boolean                         haveStatus;
+
        /* run loop source, callout, context, rl scheduling info */
        Boolean                         scheduled;
        CFRunLoopSourceRef              rls;
@@ -96,11 +104,10 @@ typedef struct {
        SCNetworkConnectionContext      rlsContext;
        CFMutableArrayRef               rlList;
 
-#if    !TARGET_OS_IPHONE
-       dispatch_queue_t                dispatchQueue;          // SCNetworkConnectionSetDispatchQueue
+       /* SCNetworkConnectionSetDispatchQueue */
+       dispatch_queue_t                dispatchQueue;
        dispatch_queue_t                callbackQueue;
        dispatch_source_t               callbackSource;
-#endif // !TARGET_OS_IPHONE
 
 } SCNetworkConnectionPrivate, *SCNetworkConnectionPrivateRef;
 
@@ -186,6 +193,16 @@ static const CFRuntimeClass __SCNetworkConnectionClass = {
 };
 
 
+static void
+childForkHandler()
+{
+       /* the process has forked (and we are the child process) */
+
+       scnc_server = MACH_PORT_NULL;
+       return;
+}
+
+
 static void
 __SCNetworkConnectionInitialize(void)
 {
@@ -200,38 +217,49 @@ __SCNetworkConnectionInitialize(void)
                }
        }
 
+       /* register with CoreFoundation */
        __kSCNetworkConnectionTypeID = _CFRuntimeRegisterClass(&__SCNetworkConnectionClass);
+
+       /* add handler to cleanup after fork() */
+       (void) pthread_atfork(NULL, NULL, childForkHandler);
+
        return;
 }
 
 
+static Boolean
+__SCNetworkConnectionReconnectNotifications(SCNetworkConnectionRef connection);
+
+
 static void
 __SCNetworkConnectionCallBack(CFMachPortRef port, void * msg, CFIndex size, void * info)
 {
-       mach_msg_empty_rcv_t *          buf                     = msg;
+       mach_no_senders_notification_t  *buf                    = msg;
+       mach_msg_id_t                   msgid                   = buf->not_header.msgh_id;
+
        SCNetworkConnectionRef          connection              = (SCNetworkConnectionRef)info;
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        void                            *context_info;
        void                            (*context_release)(const void *);
-       int                             error                   = kSCStatusFailed;
-       mach_msg_id_t                   msgid                   = buf->header.msgh_id;
-       SCNetworkConnectionCallBack     rlsFunction;
-       SCNetworkConnectionStatus       scstatus = kSCNetworkConnectionInvalid;
+       SCNetworkConnectionCallBack     rlsFunction             = NULL;
+       SCNetworkConnectionStatus       nc_status               = kSCNetworkConnectionInvalid;
 
        if (msgid == MACH_NOTIFY_NO_SENDERS) {
+               // re-establish notification
                SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCNetworkConnectionCallBack: PPPController server died"));
-       } else {
-               (void) pppcontroller_getstatus(connectionPrivate->session_port, &scstatus, &error);
+               (void)__SCNetworkConnectionReconnectNotifications(connection);
        }
 
+       pthread_mutex_lock(&connectionPrivate->lock);
+
        if (!connectionPrivate->scheduled) {
                // if not currently scheduled
-               return;
+               goto doit;
        }
 
        rlsFunction = connectionPrivate->rlsFunction;
        if (rlsFunction == NULL) {
-               return;
+               goto doit;
        }
 
        if ((connectionPrivate->rlsContext.retain != NULL) && (connectionPrivate->rlsContext.info != NULL)) {
@@ -242,7 +270,16 @@ __SCNetworkConnectionCallBack(CFMachPortRef port, void * msg, CFIndex size, void
                context_release = NULL;
        }
 
-       (*rlsFunction)(connection, scstatus, context_info);
+    doit :
+
+       pthread_mutex_unlock(&connectionPrivate->lock);
+
+       if (rlsFunction == NULL) {
+               return;
+       }
+
+       nc_status = SCNetworkConnectionGetStatus(connection);
+       (*rlsFunction)(connection, nc_status, context_info);
        if ((context_release != NULL) && (context_info != NULL)) {
                (*context_release)(context_info);
        }
@@ -321,140 +358,425 @@ __SCNetworkConnectionCreatePrivate(CFAllocatorRef               allocator,
 }
 
 
+static mach_port_t
+__SCNetworkConnectionServerPort(kern_return_t *status)
+{
+       mach_port_t     server  = MACH_PORT_NULL;
+
+#ifdef BOOTSTRAP_PRIVILEGED_SERVER
+       *status = bootstrap_look_up2(bootstrap_port,
+                                    PPPCONTROLLER_SERVER,
+                                    &server,
+                                    0,
+                                    BOOTSTRAP_PRIVILEGED_SERVER);
+#else  // BOOTSTRAP_PRIVILEGED_SERVER
+       *status = bootstrap_look_up(bootstrap_port, PPPCONTROLLER_SERVER, &server);
+#endif // BOOTSTRAP_PRIVILEGED_SERVER
+
+       switch (*status) {
+               case BOOTSTRAP_SUCCESS :
+                       // service currently registered, "a good thing" (tm)
+                       return server;
+               case BOOTSTRAP_NOT_PRIVILEGED :
+                       // the service is not privileged
+                       break;
+               case BOOTSTRAP_UNKNOWN_SERVICE :
+                       // service not currently registered, try again later
+                       break;
+               default :
+#ifdef DEBUG
+                       SCLog(_sc_verbose, LOG_DEBUG,
+                             CFSTR("SCNetworkConnection bootstrap_look_up() failed: status=%s"),
+                             bootstrap_strerror(*status));
+#endif // DEBUG
+                       break;
+       }
+
+       return MACH_PORT_NULL;
+}
+
+
 static mach_port_t
 __SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate)
 {
-       void            *data;
-       CFIndex         dataLen;
-       CFDataRef       dataRef                 = NULL;
-       int             error                   = kSCStatusFailed;
-       mach_port_t     notify_port             = 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;
+       void            *data           = NULL;
+       CFIndex         dataLen         = 0;
+       CFDataRef       dataRef         = NULL;
+       mach_port_t     notify_port     = MACH_PORT_NULL;
+       mach_port_t     oldNotify       = MACH_PORT_NULL;
+       int             retry           = 0;
+       int             sc_status       = kSCStatusFailed;
+       mach_port_t     server          = scnc_server;
+       kern_return_t   status          = KERN_SUCCESS;
+       mach_port_t     au_session      = MACH_PORT_NULL;
 
        if (connectionPrivate->session_port != MACH_PORT_NULL) {
                return connectionPrivate->session_port;
        }
 
-       pthread_mutex_lock(&connectionPrivate->lock);
-
-       if (bootstrap_look_up(bootstrap_port, PPPCONTROLLER_SERVER, &server) != BOOTSTRAP_SUCCESS) {
-               SCLog(_sc_verbose, LOG_ERR, CFSTR("PPP Controller not found"));
-               goto done;
-       }
-
        if (!_SCSerializeString(SCNetworkServiceGetServiceID(connectionPrivate->service), &dataRef, &data, &dataLen)) {
                goto done;
        }
 
-       status = bootstrap_unprivileged(bootstrap_port, &unpriv_bootstrap_port);
-       if (status != BOOTSTRAP_SUCCESS) {
-               goto done;
+       if (connectionPrivate->notify_port != NULL) {
+               mach_port_t     mp      = CFMachPortGetPort(connectionPrivate->notify_port);
+
+               __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionReconnectNotifications mp", mp);
+               CFMachPortInvalidate(connectionPrivate->notify_port);
+               CFRelease(connectionPrivate->notify_port);
+               connectionPrivate->notify_port = NULL;
+               mach_port_mod_refs(mach_task_self(), mp, MACH_PORT_RIGHT_RECEIVE, -1);
        }
 
-       if (connectionPrivate->rlsFunction != NULL) {
-               /* allocate port (for server response) */
-               status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &notify_port);
-               if (status != KERN_SUCCESS) {
-                       goto done;
-               }
+       au_session = audit_session_self();
 
-               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;
-               }
+       // open a new session with the server
+       while (TRUE) {
+               if ((connectionPrivate->rlsFunction != NULL) && (notify_port == MACH_PORT_NULL)) {
+                       // allocate port (for server response)
+                       status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &notify_port);
+                       if (status != KERN_SUCCESS) {
+                               SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionSessionPort mach_port_allocate(): %s"), mach_error_string(status));
+                               sc_status = status;
+                               goto done;
+                       }
 
-               /* request a notification when/if the server dies */
-               status = mach_port_request_notification(mach_task_self(),
+                       // add send right (passed to the server)
+                       status = mach_port_insert_right(mach_task_self(),
                                                        notify_port,
-                                                       MACH_NOTIFY_NO_SENDERS,
-                                                       1,
                                                        notify_port,
-                                                       MACH_MSG_TYPE_MAKE_SEND_ONCE,
-                                                       &oldNotify);
-               if (status != KERN_SUCCESS) {
-                       goto done;
+                                                       MACH_MSG_TYPE_MAKE_SEND);
+                       if (status != KERN_SUCCESS) {
+                               SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionSessionPort mach_port_insert_right(): %s"), mach_error_string(status));
+                               mach_port_mod_refs(mach_task_self(), notify_port, MACH_PORT_RIGHT_RECEIVE, -1);
+                               sc_status = status;
+                               goto done;
+                       }
                }
 
-               if (oldNotify != MACH_PORT_NULL) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionSessionPort(): oldNotify != MACH_PORT_NULL"));
+               if (server != MACH_PORT_NULL) {
+                       status = pppcontroller_attach(server,
+                                                     data,
+                                                     dataLen,
+                                                     bootstrap_port,
+                                                     notify_port,
+                                                     au_session,
+                                                     &connectionPrivate->session_port,
+                                                     &sc_status);
+                       if (status == KERN_SUCCESS) {
+                               if (sc_status != kSCStatusOK) {
+                                       SCLog(TRUE, LOG_DEBUG,
+                                             CFSTR("__SCNetworkConnectionSessionPort : attach w/error, sc_status=%s%s"),
+                                             SCErrorString(sc_status),
+                                             (connectionPrivate->session_port != MACH_PORT_NULL) ? ", w/session_port!=MACH_PORT_NULL" : "");
+
+                                       if (connectionPrivate->session_port != MACH_PORT_NULL) {
+                                               __MACH_PORT_DEBUG(TRUE,
+                                                                 "*** __SCNetworkConnectionSessionPort session_port (attach w/error, cleanup)",
+                                                                 connectionPrivate->session_port);
+                                               mach_port_deallocate(mach_task_self(), connectionPrivate->session_port);
+                                               connectionPrivate->session_port = MACH_PORT_NULL;
+                                       }
+
+                                       if (notify_port != MACH_PORT_NULL) {
+                                               __MACH_PORT_DEBUG(TRUE,
+                                                                 "*** __SCNetworkConnectionSessionPort notify_port (attach w/error, cleanup)",
+                                                                 notify_port);
+                                               (void) mach_port_mod_refs(mach_task_self(), notify_port, MACH_PORT_RIGHT_RECEIVE, -1);
+                                               notify_port = MACH_PORT_NULL;
+                                       }
+                               }
+                               break;
+                       }
+
+                       // our [cached] server port is not valid
+                       SCLog(TRUE, LOG_DEBUG, CFSTR("__SCNetworkConnectionSessionPort : !attach: %s"), SCErrorString(status));
+                       if (status == MACH_SEND_INVALID_DEST) {
+                               // the server is not yet available
+                               __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionSessionPort notify_port (!dest)", notify_port);
+                       } else if (status == MIG_SERVER_DIED) {
+                               __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionSessionPort notify_port (!mig)", notify_port);
+                               // the server we were using is gone and we've lost our send right
+                               mach_port_mod_refs(mach_task_self(), notify_port, MACH_PORT_RIGHT_RECEIVE, -1);
+                               notify_port = MACH_PORT_NULL;
+                       } else {
+                               // if we got an unexpected error, don't retry
+                               sc_status = status;
+                               break;
+                       }
                }
 
-               __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionSessionPort notify_port (before)", notify_port);
-       }
+               pthread_mutex_lock(&scnc_lock);
+               if (scnc_server != MACH_PORT_NULL) {
+                       if (server == scnc_server) {
+                               // if the server we tried returned the error
+                               (void)mach_port_deallocate(mach_task_self(), scnc_server);
+                               scnc_server = __SCNetworkConnectionServerPort(&sc_status);
+                       } else {
+                               // another thread has refreshed the server port
+                       }
+               } else {
+                       scnc_server = __SCNetworkConnectionServerPort(&sc_status);
+               }
+               server = scnc_server;
+               pthread_mutex_unlock(&scnc_lock);
+
+               if (server == MACH_PORT_NULL) {
+                       // if server not available
+                       if (sc_status == BOOTSTRAP_UNKNOWN_SERVICE) {
+                               // if first retry attempt, wait for SCDynamicStore server
+                               if (retry == 0) {
+                                       SCDynamicStoreRef       store;
+
+                                       store = SCDynamicStoreCreate(NULL,
+                                                                    CFSTR("SCNetworkConnection connect"),
+                                                                    NULL,
+                                                                    NULL);
+                                       if (store != NULL) {
+                                               CFRelease(store);
+                                       }
+                               }
 
-       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;
+                               // wait up to 2.5 seconds for the [SCNetworkConnection] server
+                               // to startup
+                               if ((retry += 50) < 2500) {
+                                       usleep(50 * 1000);      // sleep 50ms between attempts
+                                       continue;
+                               }
+                       }
+                       break;
                }
-               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
-               };
+               if (connectionPrivate->session_port != MACH_PORT_NULL) {
+                       CFMachPortContext       context = { 0
+                                                         , (void *)connectionPrivate
+                                                         , NULL
+                                                         , NULL
+                                                         , pppMPCopyDescription
+                       };
+
+                       // request a notification when/if the server dies
+                       status = mach_port_request_notification(mach_task_self(),
+                                                               notify_port,
+                                                               MACH_NOTIFY_NO_SENDERS,
+                                                               1,
+                                                               notify_port,
+                                                               MACH_MSG_TYPE_MAKE_SEND_ONCE,
+                                                               &oldNotify);
+                       if (status != KERN_SUCCESS) {
+                               SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionSessionPort mach_port_request_notification(): %s"), mach_error_string(status));
+                               mach_port_mod_refs(mach_task_self(), notify_port, MACH_PORT_RIGHT_RECEIVE, -1);
+                               sc_status = status;
+                               goto done;
+                       }
+
+                       if (oldNotify != MACH_PORT_NULL) {
+                               SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionSessionPort(): oldNotify != MACH_PORT_NULL"));
+                       }
 
-               connectionPrivate->notify_port = CFMachPortCreateWithPort(NULL, notify_port, __SCNetworkConnectionCallBack, &context, NULL);
+                       // create CFMachPort for SCNetworkConnection notification callback
+                       connectionPrivate->notify_port = _SC_CFMachPortCreateWithPort("SCNetworkConnection",
+                                                                                     notify_port,
+                                                                                     __SCNetworkConnectionCallBack,
+                                                                                     &context);
+
+                       // we need to try a bit harder to acquire the initial status
+                       connectionPrivate->haveStatus = FALSE;
+               } else {
+                       // with no server port, release the notification port we allocated
+                       __MACH_PORT_DEBUG(TRUE,
+                                         "*** __SCNetworkConnectionSessionPort notify_port (!server)",
+                                         notify_port);
+                       (void) mach_port_mod_refs  (mach_task_self(), notify_port, MACH_PORT_RIGHT_RECEIVE, -1);
+                       (void) mach_port_deallocate(mach_task_self(), notify_port);
+                       notify_port = MACH_PORT_NULL;
+               }
        }
 
     done :
 
+       // clean up
+       if (au_session != MACH_PORT_NULL) {
+               (void)mach_port_deallocate(mach_task_self(), au_session);
+       }
+
        if (dataRef != NULL)    CFRelease(dataRef);
 
-       if (unpriv_bootstrap_port != MACH_PORT_NULL) {
-               mach_port_deallocate(mach_task_self(), unpriv_bootstrap_port);
+       switch (sc_status) {
+               case kSCStatusOK :
+                       __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);
+                       break;
+               case BOOTSTRAP_UNKNOWN_SERVICE :
+                       SCLog(TRUE,
+                             (status == KERN_SUCCESS) ? LOG_DEBUG : LOG_ERR,
+                             CFSTR("PPPController not available"));
+                       break;
+               default :
+                       SCLog(TRUE,
+                             (status == KERN_SUCCESS) ? LOG_DEBUG : LOG_ERR,
+                             CFSTR("__SCNetworkConnectionSessionPort pppcontroller_attach(): %s"),
+                             SCErrorString(sc_status));
+                       break;
        }
 
-       if (error != kSCStatusOK) {
-               if (connectionPrivate->session_port != MACH_PORT_NULL) {
-                       __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);
+       if (sc_status != kSCStatusOK) {
+               _SCErrorSet(sc_status);
+       }
 
-                       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);
+       return connectionPrivate->session_port;
+}
+
+
+static Boolean
+__SCNetworkConnectionReconnect(SCNetworkConnectionRef connection)
+{
+       SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
+       mach_port_t                     port;
+
+       port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       return (port != MACH_PORT_NULL);
+}
+
+
+static Boolean
+__SCNetworkConnectionReconnectNotifications(SCNetworkConnectionRef connection)
+{
+       SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
+       dispatch_queue_t                dispatchQueue           = NULL;
+       Boolean                         ok                      = TRUE;
+       CFArrayRef                      rlList                  = NULL;
+
+       // Before we fully tearing down our [old] notifications, make sure
+       // we have retained any information that is needed to re-register the
+       // [new] notifications.
+
+       pthread_mutex_lock(&connectionPrivate->lock);
+
+       if (connectionPrivate->rlList != NULL) {
+               rlList = CFArrayCreateCopy(NULL, connectionPrivate->rlList);
+       }
+       if (connectionPrivate->dispatchQueue != NULL) {
+               dispatchQueue = connectionPrivate->dispatchQueue;
+               dispatch_retain(dispatchQueue);
+       }
+
+       // cancel [old] notifications
+       if (connectionPrivate->rlList != NULL) {
+               CFRelease(connectionPrivate->rlList);
+               connectionPrivate->rlList = NULL;
+       }
+       if (connectionPrivate->rls != NULL) {
+               CFRunLoopSourceInvalidate(connectionPrivate->rls);
+               CFRelease(connectionPrivate->rls);
+               connectionPrivate->rls = NULL;
+       }
+       if (connectionPrivate->callbackSource != NULL) {
+               dispatch_source_cancel(connectionPrivate->callbackSource);
+               if (connectionPrivate->callbackQueue != dispatch_get_current_queue()) {
+                       // ensure the cancellation has completed
+                       dispatch_sync(connectionPrivate->callbackQueue, ^{});
                }
-               _SCErrorSet(error);
+               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;
+       }
+
+       connectionPrivate->scheduled = FALSE;
 
        pthread_mutex_unlock(&connectionPrivate->lock);
 
-       return connectionPrivate->session_port;
+       // re-schedule
+       if (rlList != NULL) {
+               CFIndex i;
+               CFIndex n;
+
+               n = CFArrayGetCount(rlList);
+               for (i = 0; i < n; i += 3) {
+                       CFRunLoopRef    rl      = (CFRunLoopRef)CFArrayGetValueAtIndex(rlList, i+1);
+                       CFStringRef     rlMode  = (CFStringRef) CFArrayGetValueAtIndex(rlList, i+2);
+
+                       ok = SCNetworkConnectionScheduleWithRunLoop(connection, rl, rlMode);
+                       if (!ok) {
+                               SCLog((SCError() != BOOTSTRAP_UNKNOWN_SERVICE),
+                                     LOG_ERR,
+                                     CFSTR("__SCNetworkConnectionReconnectNotifications: SCNetworkConnectionScheduleWithRunLoop() failed"));
+                               goto done;
+                       }
+               }
+       } else if (dispatchQueue != NULL) {
+               ok = SCNetworkConnectionSetDispatchQueue(connection, dispatchQueue);
+               if (!ok) {
+                       SCLog((SCError() != BOOTSTRAP_UNKNOWN_SERVICE),
+                             LOG_ERR,
+                             CFSTR("__SCNetworkConnectionReconnectNotifications: SCNetworkConnectionSetDispatchQueue() failed"));
+                       goto done;
+               }
+       } else {
+               ok = FALSE;
+       }
+
+    done :
+
+       // cleanup
+       if (rlList != NULL) {
+               CFRelease(rlList);
+       }
+       if (dispatchQueue != NULL) {
+               dispatch_release(dispatchQueue);
+       }
+
+       if (!ok) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCNetworkConnection server %s, notification not restored"),
+                     (SCError() == BOOTSTRAP_UNKNOWN_SERVICE) ? "shutdown" : "failed");
+       }
+
+       return ok;
+}
+
+
+static Boolean
+__SCNetworkConnectionNeedsRetry(SCNetworkConnectionRef connection,
+                               const char              *error_label,
+                               kern_return_t           status,
+                               int                     *sc_status)
+{
+       SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
+
+       if (status == KERN_SUCCESS) {
+               return FALSE;
+       }
+
+       if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+               // the server's gone and our session port's dead, remove the dead name right
+               (void) mach_port_deallocate(mach_task_self(), connectionPrivate->session_port);
+       } else {
+               // we got an unexpected error, leave the [session] port alone
+               SCLog(TRUE, LOG_ERR, CFSTR("%s: %s"), error_label, mach_error_string(status));
+       }
+       connectionPrivate->session_port = MACH_PORT_NULL;
+       if ((status == MACH_SEND_INVALID_DEST) || (status == MIG_SERVER_DIED)) {
+               if (__SCNetworkConnectionReconnect(connection)) {
+                       return TRUE;
+               }
+       }
+       *sc_status = status;
+
+       return FALSE;
 }
 
 
@@ -506,6 +828,7 @@ SCNetworkConnectionCopyAvailableServices(SCNetworkSetRef set)
 
                                interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
                                if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP) ||
+                                   CFEqual(interfaceType, kSCNetworkInterfaceTypeVPN) ||
                                    CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) {
                                        CFArrayAppendValue(available, service);
                                }
@@ -587,8 +910,8 @@ SCNetworkConnectionCopyStatistics(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        xmlDataOut_t                    data                    = NULL;
-       mach_msg_type_number_t          datalen;
-       int                             error                   = kSCStatusFailed;
+       mach_msg_type_number_t          datalen                 = 0;
+       int                             sc_status               = kSCStatusFailed;
        mach_port_t                     session_port;
        CFPropertyListRef               statistics              = NULL;
        kern_return_t                   status;
@@ -598,34 +921,44 @@ SCNetworkConnectionCopyStatistics(SCNetworkConnectionRef connection)
                return NULL;
        }
 
+       pthread_mutex_lock(&connectionPrivate->lock);
+
+    retry :
+
        session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
        if (session_port == MACH_PORT_NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
+               goto done;
        }
 
-       status = pppcontroller_copystatistics(session_port, &data, &datalen, &error);
-       if (status != KERN_SUCCESS) {
-               goto fail;
+       status = pppcontroller_copystatistics(session_port, &data, &datalen, &sc_status);
+       if (__SCNetworkConnectionNeedsRetry(connection,
+                                           "SCNetworkConnectionCopyStatistics()",
+                                           status,
+                                           &sc_status)) {
+               goto retry;
        }
 
-       if (error != kSCStatusOK) {
-               goto fail;
+       if (data != NULL) {
+               if (!_SCUnserialize(&statistics, NULL, data, datalen)) {
+                       if (sc_status != kSCStatusOK) sc_status = SCError();
+               }
+               if ((sc_status == kSCStatusOK) && !isA_CFDictionary(statistics)) {
+                       sc_status = kSCStatusFailed;
+               }
        }
 
-       if ((data == NULL) ||
-           !_SCUnserialize(&statistics, NULL, data, datalen) ||
-           !isA_CFDictionary(statistics)) {
-               goto fail;
+       if (sc_status != kSCStatusOK) {
+               if (statistics != NULL) {
+                       CFRelease(statistics);
+                       statistics = NULL;
+               }
+               _SCErrorSet(sc_status);
        }
 
-       return statistics;
-
-    fail:
+    done :
 
-       if (statistics) CFRelease(statistics);
-       _SCErrorSet(error);
-       return NULL;
+       pthread_mutex_unlock(&connectionPrivate->lock);
+       return statistics;
 }
 
 
@@ -647,8 +980,9 @@ SCNetworkConnectionStatus
 SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
-       int                             error                   = kSCStatusFailed;
-       SCNetworkConnectionStatus       scstatus;
+       SCNetworkConnectionStatus       nc_status               = kSCNetworkConnectionInvalid;
+       int                             retry                   = 0;
+       int                             sc_status               = kSCStatusFailed;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
@@ -657,24 +991,43 @@ SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection)
                return kSCNetworkConnectionInvalid;
        }
 
+       pthread_mutex_lock(&connectionPrivate->lock);
+
+    retry :
+
        session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
        if (session_port == MACH_PORT_NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return kSCNetworkConnectionInvalid;
+               nc_status = kSCNetworkConnectionInvalid;
+               goto done;
        }
 
-       status = pppcontroller_getstatus(session_port, &scstatus, &error);
-       if (status != KERN_SUCCESS) {
-               _SCErrorSet(kSCStatusFailed);
-               return kSCNetworkConnectionInvalid;
+       status = pppcontroller_getstatus(session_port, &nc_status, &sc_status);
+       if (__SCNetworkConnectionNeedsRetry(connection,
+                                           "SCNetworkConnectionGetStatus()",
+                                           status,
+                                           &sc_status)) {
+               goto retry;
        }
 
-       if (error != kSCStatusOK) {
-               _SCErrorSet(error);
-               return kSCNetworkConnectionInvalid;
+       // wait up to 250 ms for the network service to become available
+       if (!connectionPrivate->haveStatus &&
+           (sc_status == kSCStatusConnectionNoService) &&
+           ((retry += 10) < 250)) {
+               usleep(10 * 1000);      // sleep 10ms between attempts
+               goto retry;
+       }
+
+       if (sc_status == kSCStatusOK) {
+               connectionPrivate->haveStatus = TRUE;
+       } else {
+               _SCErrorSet(sc_status);
+               nc_status = kSCNetworkConnectionInvalid;
        }
 
-       return scstatus;
+    done :
+
+       pthread_mutex_unlock(&connectionPrivate->lock);
+       return nc_status;
 }
 
 
@@ -683,9 +1036,10 @@ SCNetworkConnectionCopyExtendedStatus(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        xmlDataOut_t                    data                    = NULL;
-       mach_msg_type_number_t          datalen;
-       int                             error                   = kSCStatusFailed;
+       mach_msg_type_number_t          datalen                 = 0;
        CFPropertyListRef               extstatus               = NULL;
+       int                             retry                   = 0;
+       int                             sc_status               = kSCStatusFailed;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
@@ -694,34 +1048,54 @@ SCNetworkConnectionCopyExtendedStatus(SCNetworkConnectionRef connection)
                return NULL;
        }
 
+       pthread_mutex_lock(&connectionPrivate->lock);
+
+    retry :
+
        session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
        if (session_port == MACH_PORT_NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
+               goto done;
        }
 
-       status = pppcontroller_copyextendedstatus(session_port, &data, &datalen, &error);
-       if (status != KERN_SUCCESS) {
-               goto fail;
+       status = pppcontroller_copyextendedstatus(session_port, &data, &datalen, &sc_status);
+       if (__SCNetworkConnectionNeedsRetry(connection,
+                                           "SCNetworkConnectionCopyExtendedStatus()",
+                                           status,
+                                           &sc_status)) {
+               goto retry;
        }
 
-       if (error != kSCStatusOK) {
-               goto fail;
+       if (data != NULL) {
+               if (!_SCUnserialize(&extstatus, NULL, data, datalen)) {
+                       if (sc_status != kSCStatusOK) sc_status = SCError();
+               }
+               if ((sc_status == kSCStatusOK) && !isA_CFDictionary(extstatus)) {
+                       sc_status = kSCStatusFailed;
+               }
        }
 
-       if ((data == NULL) ||
-           !_SCUnserialize(&extstatus, NULL, data, datalen) ||
-           !isA_CFDictionary(extstatus)) {
-               goto fail;
+       // wait up to 250 ms for the network service to become available
+       if (!connectionPrivate->haveStatus &&
+           (sc_status == kSCStatusConnectionNoService) &&
+           ((retry += 10) < 250)) {
+               usleep(10 * 1000);      // sleep 10ms between attempts
+               goto retry;
        }
 
-       return extstatus;
+       if (sc_status == kSCStatusOK) {
+               connectionPrivate->haveStatus = TRUE;
+       } else {
+               if (extstatus != NULL)  {
+                       CFRelease(extstatus);
+                       extstatus = NULL;
+               }
+               _SCErrorSet(sc_status);
+       }
 
-    fail:
+    done :
 
-       if (extstatus)  CFRelease(extstatus);
-       _SCErrorSet(error);
-       return NULL;
+       pthread_mutex_unlock(&connectionPrivate->lock);
+       return extstatus;
 }
 
 
@@ -734,7 +1108,8 @@ SCNetworkConnectionStart(SCNetworkConnectionRef    connection,
        CFDataRef                       dataref                 = NULL;
        void                            *data                   = NULL;
        CFIndex                         datalen                 = 0;
-       int                             error                   = kSCStatusFailed;
+       Boolean                         ok                      = FALSE;
+       int                             sc_status               = kSCStatusFailed;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
@@ -748,12 +1123,6 @@ SCNetworkConnectionStart(SCNetworkConnectionRef   connection,
                return FALSE;
        }
 
-       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
-       if (session_port == MACH_PORT_NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
        if (debug > 0) {
                CFMutableDictionaryRef  mdict = NULL;
 
@@ -809,35 +1178,44 @@ SCNetworkConnectionStart(SCNetworkConnectionRef  connection,
        }
 
        if (userOptions && !_SCSerialize(userOptions, &dataref, &data, &datalen)) {
-               goto fail;
+               return FALSE;
        }
 
-       status = pppcontroller_start(session_port, data, datalen, linger, &error);
-       if (status != KERN_SUCCESS) {
-               goto fail;
+       pthread_mutex_lock(&connectionPrivate->lock);
+
+    retry :
+
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               if (dataref)    CFRelease(dataref);
+               goto done;
        }
 
-       if (dataref) {
-               CFRelease(dataref);
-               dataref = NULL;
+       status = pppcontroller_start(session_port, data, datalen, linger, &sc_status);
+       if (__SCNetworkConnectionNeedsRetry(connection,
+                                           "SCNetworkConnectionStart()",
+                                           status,
+                                           &sc_status)) {
+               goto retry;
        }
 
+       if (dataref)    CFRelease(dataref);
+
        if (debug > 0) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStart (0x%x), return: %d"), connectionPrivate, error);
+               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStart (0x%x), return: %d"), connectionPrivate, sc_status);
        }
 
-       if (error != kSCStatusOK) {
-               goto fail;
+       if (sc_status != kSCStatusOK) {
+               _SCErrorSet(sc_status);
+               goto done;
        }
 
        /* connection is now started */
-       return TRUE;
-
-    fail:
+       ok = TRUE;
 
-       if (dataref)    CFRelease(dataref);
-       _SCErrorSet(error);
-       return FALSE;
+    done:
+       pthread_mutex_unlock(&connectionPrivate->lock);
+       return ok;
 }
 
 
@@ -846,7 +1224,8 @@ SCNetworkConnectionStop(SCNetworkConnectionRef     connection,
                        Boolean                 forceDisconnect)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
-       int                             error                   = kSCStatusFailed;
+       Boolean                         ok                      = FALSE;
+       int                             sc_status               = kSCStatusFailed;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
@@ -855,36 +1234,43 @@ SCNetworkConnectionStop(SCNetworkConnectionRef   connection,
                return FALSE;
        }
 
-       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
-       if (session_port == MACH_PORT_NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
        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;
+       pthread_mutex_lock(&connectionPrivate->lock);
+
+    retry :
+
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               goto done;
+       }
+
+       status = pppcontroller_stop(session_port, forceDisconnect, &sc_status);
+       if (__SCNetworkConnectionNeedsRetry(connection,
+                                           "SCNetworkConnectionStop()",
+                                           status,
+                                           &sc_status)) {
+               goto retry;
        }
 
        if (debug > 0) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStop (0x%x), return: %d"), connectionPrivate, error);
+               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStop (0x%x), return: %d"), connectionPrivate, sc_status);
        }
 
-       if (error != kSCStatusOK) {
-               goto fail;
+       if (sc_status != kSCStatusOK) {
+               _SCErrorSet(sc_status);
+               goto done;
        }
 
        /* connection is now disconnecting */
-       return TRUE;
+       ok = TRUE;
 
-    fail:
+    done :
 
-       _SCErrorSet(error);
-       return FALSE;
+       pthread_mutex_unlock(&connectionPrivate->lock);
+       return ok;
 }
 
 
@@ -892,7 +1278,8 @@ Boolean
 SCNetworkConnectionSuspend(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
-       int                             error                   = kSCStatusFailed;
+       Boolean                         ok                      = FALSE;
+       int                             sc_status               = kSCStatusFailed;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
@@ -901,36 +1288,43 @@ SCNetworkConnectionSuspend(SCNetworkConnectionRef connection)
                return FALSE;
        }
 
-       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
-       if (session_port == MACH_PORT_NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
        if (debug > 0) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x)"), connectionPrivate);
        }
 
-       status = pppcontroller_suspend(session_port, &error);
-       if (status != KERN_SUCCESS) {
-               goto fail;
+       pthread_mutex_lock(&connectionPrivate->lock);
+
+    retry :
+
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               goto done;
+       }
+
+       status = pppcontroller_suspend(session_port, &sc_status);
+       if (__SCNetworkConnectionNeedsRetry(connection,
+                                           "SCNetworkConnectionSuspend()",
+                                           status,
+                                           &sc_status)) {
+               goto retry;
        }
 
        if (debug > 0) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x), return: %d"), connectionPrivate, error);
+               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x), return: %d"), connectionPrivate, sc_status);
        }
 
-       if (error != kSCStatusOK) {
-               goto fail;
+       if (sc_status != kSCStatusOK) {
+               _SCErrorSet(sc_status);
+               goto done;
        }
 
        /* connection is now suspended */
-       return TRUE;
+       ok = TRUE;
 
-    fail:
+    done :
 
-       _SCErrorSet(error);
-       return FALSE;
+       pthread_mutex_unlock(&connectionPrivate->lock);
+       return ok;
 }
 
 
@@ -938,7 +1332,8 @@ Boolean
 SCNetworkConnectionResume(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
-       int                             error                   = kSCStatusFailed;
+       Boolean                         ok                      = FALSE;
+       int                             sc_status               = kSCStatusFailed;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
@@ -947,36 +1342,43 @@ SCNetworkConnectionResume(SCNetworkConnectionRef connection)
                return FALSE;
        }
 
-       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
-       if (session_port == MACH_PORT_NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
        if (debug > 0) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x)"), connectionPrivate);
        }
 
-       status = pppcontroller_resume(session_port, &error);
-       if (status != KERN_SUCCESS) {
-               goto fail;
+       pthread_mutex_lock(&connectionPrivate->lock);
+
+    retry :
+
+       session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+       if (session_port == MACH_PORT_NULL) {
+               goto done;
+       }
+
+       status = pppcontroller_resume(session_port, &sc_status);
+       if (__SCNetworkConnectionNeedsRetry(connection,
+                                           "SCNetworkConnectionResume()",
+                                           status,
+                                           &sc_status)) {
+               goto retry;
        }
 
        if (debug > 0) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x), return: %d"), connectionPrivate, error);
+               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x), return: %d"), connectionPrivate, sc_status);
        }
 
-       if (error != kSCStatusOK) {
-               goto fail;
+       if (sc_status != kSCStatusOK) {
+               _SCErrorSet(sc_status);
+               goto done;
        }
 
        /* connection is now resume */
-       return TRUE;
+       ok = TRUE;
 
-    fail:
+    done :
 
-       _SCErrorSet(error);
-       return FALSE;
+       pthread_mutex_unlock(&connectionPrivate->lock);
+       return ok;
 }
 
 
@@ -985,8 +1387,8 @@ SCNetworkConnectionCopyUserOptions(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        xmlDataOut_t                    data                    = NULL;
-       mach_msg_type_number_t          datalen;
-       int                             error                   = kSCStatusFailed;
+       mach_msg_type_number_t          datalen                 = 0;
+       int                             sc_status               = kSCStatusFailed;
        mach_port_t                     session_port;
        kern_return_t                   status;
        CFPropertyListRef               userOptions             = NULL;
@@ -996,106 +1398,126 @@ SCNetworkConnectionCopyUserOptions(SCNetworkConnectionRef connection)
                return NULL;
        }
 
+       pthread_mutex_lock(&connectionPrivate->lock);
+
+    retry :
+
        session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
        if (session_port == MACH_PORT_NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
+               goto done;
        }
 
-       status = pppcontroller_copyuseroptions(session_port, &data, &datalen, &error);
-       if (status != KERN_SUCCESS) {
-               goto fail;
+       status = pppcontroller_copyuseroptions(session_port, &data, &datalen, &sc_status);
+       if (__SCNetworkConnectionNeedsRetry(connection,
+                                           "SCNetworkConnectionCopyUserOptions()",
+                                           status,
+                                           &sc_status)) {
+               goto retry;
        }
 
-       if (error != kSCStatusOK) {
-               goto fail;
+       if (data != NULL) {
+               if (!_SCUnserialize(&userOptions, NULL, data, datalen)) {
+                       if (sc_status != kSCStatusOK) sc_status = SCError();
+               }
+               if ((sc_status == kSCStatusOK) && (userOptions != NULL) && !isA_CFDictionary(userOptions)) {
+                       sc_status = kSCStatusFailed;
+               }
        }
 
-       // no data were used, return an empty dictionary
-       if (data == NULL) {
-               CFDictionaryRef dict;
-
-               dict = CFDictionaryCreateMutable(NULL, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-               if (dict == NULL) {
-                       _SCErrorSet(kSCStatusFailed); // XXX
+       if (sc_status == kSCStatusOK) {
+               if (userOptions == NULL) {
+                       // if no user options, return an empty dictionary
+                       userOptions = CFDictionaryCreate(NULL,
+                                                        NULL,
+                                                        NULL,
+                                                        0,
+                                                        &kCFTypeDictionaryKeyCallBacks,
+                                                        &kCFTypeDictionaryValueCallBacks);
+               }
+       } else {
+               if (userOptions) {
+                       CFRelease(userOptions);
+                       userOptions = NULL;
                }
-               return dict;
+               _SCErrorSet(sc_status);
        }
 
-       if (!_SCUnserialize(&userOptions, NULL, data, datalen) ||
-           !isA_CFDictionary(userOptions)) {
-               goto fail;
-       }
+    done :
 
+       pthread_mutex_unlock(&connectionPrivate->lock);
        return userOptions;
-
-    fail:
-
-       if (userOptions)        CFRelease(userOptions);
-       _SCErrorSet(error);
-       return NULL;
 }
 
 
-#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) {
+               mach_msg_empty_rcv_t    *buf    = malloc(sizeof(*buf));
+
+               bcopy(message, buf, sizeof(*buf));
                CFRetain(connectionPrivate);
                dispatch_async(connectionPrivate->dispatchQueue, ^{
-                       __SCNetworkConnectionCallBack(connectionPrivate->notify_port, message, 4096, connectionPrivate);
+                       __SCNetworkConnectionCallBack(connectionPrivate->notify_port,
+                                                     buf,
+                                                     sizeof(*buf),
+                                                     connectionPrivate);
                        CFRelease(connectionPrivate);
+                       free(buf);
                });
        }
        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
-                                        )
+                                        dispatch_queue_t       queue)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
-       int                             error                   = kSCStatusFailed;
+       Boolean                         ok                      = FALSE;
+       int                             sc_status               = kSCStatusFailed;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
+       pthread_mutex_lock(&connectionPrivate->lock);
+
        if (connectionPrivate->rlsFunction == NULL) {
                _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+               goto done;
        }
 
-#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) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+               goto done;
        }
 
        if (!connectionPrivate->scheduled) {
-               status = pppcontroller_notification(session_port, 1, &error);
-               if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
-                       _SCErrorSet(error);
-                       return FALSE;
+
+           retry :
+
+               session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
+               if (session_port == MACH_PORT_NULL) {
+                       goto done;
+               }
+
+               status = pppcontroller_notification(session_port, 1, &sc_status);
+               if (__SCNetworkConnectionNeedsRetry(connection,
+                                                   "__SCNetworkConnectionScheduleWithRunLoop()",
+                                                   status,
+                                                   &sc_status)) {
+                       goto retry;
+               }
+
+               if (sc_status != kSCStatusOK) {
+                       _SCErrorSet(sc_status);
+                       goto done;
                }
 
                if (runLoop != NULL) {
@@ -1106,14 +1528,15 @@ __SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef connection,
                connectionPrivate->scheduled = TRUE;
        }
 
-#if    !TARGET_OS_IPHONE
        if (queue != NULL) {
                mach_port_t     mp;
+               char            qname[256];
 
                connectionPrivate->dispatchQueue = queue;
                dispatch_retain(connectionPrivate->dispatchQueue);
 
-               connectionPrivate->callbackQueue = dispatch_queue_create("com.apple.SCNetworkConnection.notifications", NULL);
+               snprintf(qname, sizeof(qname), "com.apple.SCNetworkConnection.%p", connection);
+               connectionPrivate->callbackQueue = dispatch_queue_create(qname, NULL);
                if (connectionPrivate->callbackQueue == NULL){
                        SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkConnection dispatch_queue_create() failed"));
                        goto fail;
@@ -1132,14 +1555,17 @@ __SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef connection,
                        goto fail;
                }
                dispatch_source_set_event_handler(connectionPrivate->callbackSource, ^{
+                       union MaxMsgSize {
+                               mach_msg_empty_rcv_t            normal;
+                               mach_no_senders_notification_t  no_senders;
+                       };
+
                        dispatch_mig_server(connectionPrivate->callbackSource,
-                                           sizeof(mach_msg_header_t),
+                                           sizeof(union MaxMsgSize),
                                            SCNetworkConnectionNotifyMIGCallback);
                });
                dispatch_resume(connectionPrivate->callbackSource);
-       } else
-#endif // !TARGET_OS_IPHONE
-       {
+       } else {
                if (!_SC_isScheduled(NULL, runLoop, runLoopMode, connectionPrivate->rlList)) {
                        /*
                         * if we do not already have notifications scheduled with
@@ -1151,9 +1577,9 @@ __SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef   connection,
                _SC_schedule(connection, runLoop, runLoopMode, connectionPrivate->rlList);
        }
 
-       return TRUE;
+       ok = TRUE;
+       goto done;
 
-#if    !TARGET_OS_IPHONE
     fail :
 
        if (connectionPrivate->callbackSource != NULL) {
@@ -1170,8 +1596,11 @@ __SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef  connection,
                connectionPrivate->dispatchQueue = NULL;
        }
        _SCErrorSet(kSCStatusFailed);
-       return FALSE;
-#endif // !TARGET_OS_IPHONE
+
+    done :
+
+       pthread_mutex_unlock(&connectionPrivate->lock);
+       return ok;
 }
 
 
@@ -1179,39 +1608,33 @@ 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
-                                          )
+                                          dispatch_queue_t             queue)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
-       int                             error                   = kSCStatusFailed;
+       int                             sc_status               = kSCStatusFailed;
        CFIndex                         n                       = 0;
+       Boolean                         ok                      = FALSE;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
+       pthread_mutex_lock(&connectionPrivate->lock);
+
        if ((runLoop != NULL) && !connectionPrivate->scheduled) {                       // if we should be scheduled (but are not)
                _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+               goto done;
        }
 
-#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;
+               goto done;
        }
-#endif // !TARGET_OS_IPHONE
 
        session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
        if (session_port == MACH_PORT_NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+               goto done;
        }
 
-#if    !TARGET_OS_IPHONE
        if (runLoop == NULL) {
                dispatch_source_cancel(connectionPrivate->callbackSource);
                if (connectionPrivate->callbackQueue != dispatch_get_current_queue()) {
@@ -1224,13 +1647,11 @@ __SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef       connection,
                connectionPrivate->callbackQueue = NULL;
                dispatch_release(connectionPrivate->dispatchQueue);
                connectionPrivate->dispatchQueue = NULL;
-       } else
-#endif // !TARGET_OS_IPHONE
-       {
+       } else {
                if (!_SC_unschedule(connection, runLoop, runLoopMode, connectionPrivate->rlList, FALSE)) {
                        // if not currently scheduled on this runLoop / runLoopMode
                        _SCErrorSet(kSCStatusFailed);
-                       return FALSE;
+                       goto done;
                }
 
                n = CFArrayGetCount(connectionPrivate->rlList);
@@ -1256,14 +1677,27 @@ __SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef       connection,
                // if *all* notifications have been unscheduled
                connectionPrivate->scheduled = FALSE;
 
-               status = pppcontroller_notification(session_port, 0, &error);
-               if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
-                       _SCErrorSet(error);
-                       return FALSE;
+               status = pppcontroller_notification(session_port, 0, &sc_status);
+               if (__SCNetworkConnectionNeedsRetry(connection,
+                                                   "__SCNetworkConnectionUnscheduleFromRunLoop pppcontroller_notification()",
+                                                   status,
+                                                   &sc_status)) {
+                       sc_status = kSCStatusOK;
+                       status = KERN_SUCCESS;
+               }
+
+               if ((status != KERN_SUCCESS) || (sc_status != kSCStatusOK)) {
+                       _SCErrorSet(sc_status);
+                       goto done;
                }
        }
 
-       return TRUE;
+       ok = TRUE;
+
+    done :
+
+       pthread_mutex_unlock(&connectionPrivate->lock);
+       return ok;
 }
 
 
@@ -1295,7 +1729,6 @@ SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef           connection,
 }
 
 
-#if    !TARGET_OS_IPHONE
 Boolean
 SCNetworkConnectionSetDispatchQueue(SCNetworkConnectionRef     connection,
                                    dispatch_queue_t            queue)
@@ -1315,7 +1748,6 @@ SCNetworkConnectionSetDispatchQueue(SCNetworkConnectionRef        connection,
 
        return ok;
 }
-#endif // !TARGET_OS_IPHONE
 
 
 #pragma mark -
@@ -2174,45 +2606,25 @@ addPasswordFromKeychain(SCDynamicStoreRef session, CFStringRef serviceID, CFDict
 static CFArrayRef
 copyKeychainEnumerator(CFStringRef uniqueIdentifier)
 {
-       char                    *buf;
-       CFMutableArrayRef       itemArray       = NULL;
+       CFArrayRef              itemArray       = NULL;
+       CFMutableDictionaryRef  query;
        OSStatus                result;
-       SecKeychainSearchRef    search          = NULL;
-
-       buf = _SC_cfstring_to_cstring(uniqueIdentifier, NULL, 0, kCFStringEncodingUTF8);
-       if (buf != NULL) {
-               // search for unique identifier in "svce" attribute
-               SecKeychainAttribute            attributes[]    = {{ kSecServiceItemAttr,
-                                                                    CFStringGetLength(uniqueIdentifier),
-                                                                    (void *)buf
-                                                                  }};
-
-               SecKeychainAttributeList        attrList        = { sizeof(attributes) / sizeof(*attributes),
-                                                                   attributes };
 
-               result = SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, &attrList, &search);
-               if (result == noErr) {
-                       itemArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-
-                       while (result == noErr) {
-                               SecKeychainItemRef      itemFound       = NULL;
-
-                               result = SecKeychainSearchCopyNext(search, &itemFound);
-                               if (result != noErr) {
-                                       break;
-                               }
-
-                               if (itemFound) {
-                                       CFArrayAppendValue(itemArray, itemFound);
-                                       CFRelease(itemFound);
-                               }
-                       }
-               }
+       query = CFDictionaryCreateMutable(NULL,
+                                         0,
+                                         &kCFTypeDictionaryKeyCallBacks,
+                                         &kCFTypeDictionaryValueCallBacks);
+       CFDictionarySetValue(query, kSecClass      , kSecClassGenericPassword);
+       CFDictionarySetValue(query, kSecAttrService, uniqueIdentifier);
+       CFDictionarySetValue(query, kSecReturnRef  , kCFBooleanTrue);
+       CFDictionarySetValue(query, kSecMatchLimit , kSecMatchLimitAll);
+       result = SecItemCopyMatching(query, (CFTypeRef *)&itemArray);
+       CFRelease(query);
+       if ((result != noErr) && (itemArray != NULL)) {
+               CFRelease(itemArray);
+               itemArray = NULL;
        }
 
-       if (search)     CFRelease(search);
-       if (buf)        CFAllocatorDeallocate(NULL, buf);
-
        return itemArray;
 }
 #endif // !TARGET_OS_IPHONE
index 7282b8740c6cde01ec0a3522e731627e3b85f6ef..38f89f77ea998fe85bc209859acc9dac0c2866f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2006, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2006, 2008-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -30,9 +30,7 @@
 #include <Availability.h>
 #include <TargetConditionals.h>
 #include <sys/cdefs.h>
-#if    !TARGET_OS_IPHONE
 #include <dispatch/dispatch.h>
-#endif // !TARGET_OS_IPHONE
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <CoreFoundation/CoreFoundation.h>
@@ -218,18 +216,16 @@ typedef void (*SCNetworkConnectionCallBack)       (
        @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 kSCNetworkConnectionSelectionOptionOnDemandHostName    CFSTR("OnDemandHostName")       // CFString
+                                                                                               // __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/)
 
 /*!
        @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
+#define kSCNetworkConnectionSelectionOptionOnDemandRetry       CFSTR("OnDemandRetry")          // CFBoolean
+                                                                                               // __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/)
 
 __BEGIN_DECLS
 
@@ -238,7 +234,6 @@ __BEGIN_DECLS
        @discussion Returns the type identifier of all SCNetworkConnection
                instances.
  */
-CF_EXPORT
 CFTypeID
 SCNetworkConnectionGetTypeID                   (void)                  __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
@@ -551,7 +546,6 @@ SCNetworkConnectionUnscheduleFromRunLoop    (
                                                )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
-#if    !TARGET_OS_IPHONE
 /*!
         @function SCNetworkConnectionSetDispatchQueue
         @discussion Caller provides a dispatch queue on which the callback contained in connection will run.
@@ -566,8 +560,7 @@ Boolean
 SCNetworkConnectionSetDispatchQueue            (
                                                 SCNetworkConnectionRef         connection,
                                                 dispatch_queue_t               queue
-                                                )                      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
-#endif // !TARGET_OS_IPHONE
+                                                )                      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0/*SPI*/);
 
 __END_DECLS
 
index 3d2a7f08eb835f8d4abd7186fba2b6c78bdb0ab2..381f75389e925b73da53a6268b03f793a8b4a689 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -201,9 +201,12 @@ logCFPreferencesChange(CFStringRef serviceID, CFArrayRef newPreferences)
 
        bVal = CFPreferencesCopyAppValue(CFSTR("LOG_SC_CHANGES"), USER_PREFERENCES_APPLICATION_ID);
        if (bVal != NULL) {
-               if (!isA_CFBoolean(bVal) || !CFBooleanGetValue(bVal)) {
+               Boolean enabled;
+
+               enabled = isA_CFBoolean(bVal) && CFBooleanGetValue(bVal);
+               CFRelease(bVal);
+               if (!enabled) {
                        // if debugging not enabled
-                       CFRelease(bVal);
                        return;
                }
        } else {
@@ -268,9 +271,9 @@ logCFPreferencesChange(CFStringRef serviceID, CFArrayRef newPreferences)
                        CFRelease(oldPreferences);
                        return;
                }
-               data = CFPropertyListCreateXMLData(NULL, oldPreferences);
+               data = CFPropertyListCreateData(NULL, oldPreferences, kCFPropertyListXMLFormat_v1_0, 0, NULL);
                if (data == NULL) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange CFPropertyListCreateXMLData() failed"));
+                       SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange CFPropertyListCreateData() failed"));
                        close(fd);
                        CFRelease(oldPreferences);
                        return;
@@ -293,9 +296,9 @@ logCFPreferencesChange(CFStringRef serviceID, CFArrayRef newPreferences)
                        SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange fopen() failed, error = %s"), SCErrorString(errno));
                        return;
                }
-               data = CFPropertyListCreateXMLData(NULL, newPreferences);
+               data = CFPropertyListCreateData(NULL, newPreferences, kCFPropertyListXMLFormat_v1_0, 0, NULL);
                if (data == NULL) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange CFPropertyListCreateXMLData() failed"));
+                       SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange CFPropertyListCreateData() failed"));
                        close(fd);
                        return;
                }
@@ -1536,6 +1539,17 @@ checkUserPreferencesPassword(SCUserPreferencesRef                userPreferences,
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeVPN : {
+                       CFStringRef     interfaceType;
+
+                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeVPN)) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+                       break;
+               }
+
                default :
                        break;
        }
@@ -1629,6 +1643,29 @@ SCUserPreferencesCheckInterfacePassword(SCUserPreferencesRef             userPreferences,
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeVPN : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get userPreferences ID
+                       unique_id = getUserPasswordID(config, userPreferences);
+
+                       // check
+                       exists = __extract_password(NULL,
+                                                   config,
+                                                   kSCPropNetVPNAuthPassword,
+                                                   kSCPropNetVPNAuthPasswordEncryption,
+                                                   kSCValNetVPNAuthPasswordEncryptionKeychain,
+                                                   unique_id,
+                                                   NULL);
+
+                       if (config != NULL)     CFRelease(config);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
@@ -1723,6 +1760,29 @@ SCUserPreferencesCopyInterfacePassword(SCUserPreferencesRef              userPreferences,
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeVPN : {
+                       CFDictionaryRef config;
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get userPreferences ID
+                       unique_id = getUserPasswordID(config, userPreferences);
+
+                       // extract
+                       (void) __extract_password(NULL,
+                                                 config,
+                                                 kSCPropNetVPNAuthPassword,
+                                                 kSCPropNetVPNAuthPasswordEncryption,
+                                                 kSCValNetVPNAuthPasswordEncryptionKeychain,
+                                                 unique_id,
+                                                 &password);
+
+                       if (config != NULL)     CFRelease(config);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return NULL;
@@ -1835,6 +1895,34 @@ SCUserPreferencesRemoveInterfacePassword(SCUserPreferencesRef            userPreferences,
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeVPN : {
+                       CFDictionaryRef config;
+                       CFDictionaryRef newConfig       = NULL;
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get userPreferences ID
+                       unique_id = getUserPasswordID(config, userPreferences);
+
+                       // remove password
+                       ok = __remove_password(NULL,
+                                              config,
+                                              kSCPropNetVPNAuthPassword,
+                                              kSCPropNetVPNAuthPasswordEncryption,
+                                              kSCValNetVPNAuthPasswordEncryptionKeychain,
+                                              unique_id,
+                                              &newConfig);
+                       if (ok) {
+                               ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig);
+                               if (newConfig != NULL) CFRelease(newConfig);
+                       }
+
+                       if (config != NULL) CFRelease(config);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
@@ -1950,7 +2038,7 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef                userPreferences,
                        // set password
                        ok = _SCSecKeychainPasswordItemSet(NULL,
                                                           shared_id,
-                                                          (label != NULL)       ? label       : CFSTR("VPN Connection"),
+                                                          (label != NULL)       ? label       : CFSTR("Network Connection"),
                                                           (description != NULL) ? description : CFSTR("IPSec Shared Secret"),
                                                           NULL,
                                                           password,
@@ -2014,7 +2102,7 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef                userPreferences,
                        // store password
                        ok = _SCSecKeychainPasswordItemSet(NULL,
                                                           xauth_id,
-                                                          (label != NULL)       ? label       : CFSTR("VPN Connection"),
+                                                          (label != NULL)       ? label       : CFSTR("Network Connection"),
                                                           (description != NULL) ? description : CFSTR("IPSec XAuth Password"),
                                                           account,
                                                           password,
@@ -2047,6 +2135,66 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef               userPreferences,
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeVPN : {
+                       CFStringRef     unique_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get userPreferences ID
+                       unique_id = getUserPasswordID(config, userPreferences);
+
+                       // User prefs auth name --> keychain "Account"
+                       if (config != NULL) {
+                               account = CFDictionaryGetValue(config, kSCPropNetVPNAuthName);
+                       }
+
+                       // User prefs "name" --> keychain "Name"
+                       label = SCUserPreferencesCopyName(userPreferences);
+
+                       // "VPN Password" --> keychain "Kind"
+                       if (bundle != NULL) {
+                               description = CFBundleCopyLocalizedString(bundle,
+                                                                         CFSTR("KEYCHAIN_KIND_VPN_PASSWORD"),
+                                                                         CFSTR("VPN Password"),
+                                                                         NULL);
+                       }
+
+                       // store password
+                       ok = _SCSecKeychainPasswordItemSet(NULL,
+                                                          unique_id,
+                                                          (label != NULL)       ? label       : CFSTR("Network Connection"),
+                                                          (description != NULL) ? description : CFSTR("VPN 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,
+                                                    kSCPropNetVPNAuthPassword,
+                                                    unique_id);
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetVPNAuthPasswordEncryption,
+                                                    kSCValNetVPNAuthPasswordEncryptionKeychain);
+                               ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig);
+                               CFRelease(newConfig);
+                       }
+
+                       if (config      != NULL) CFRelease(config);
+                       if (description != NULL) CFRelease(description);
+                       if (label       != NULL) CFRelease(label);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
index fe178739eebab372e85161f4a8b0d2dced316896..a3ec9ff2b09efed975ef51a5518e2bfa5d6e1d51 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2006, 2008, 2009, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -62,6 +62,12 @@ SCNetworkConnectionCopyCurrentUserPreferences        (SCNetworkConnectionRef         connectio
 SCUserPreferencesRef
 SCNetworkConnectionCreateUserPreferences       (SCNetworkConnectionRef         connection)             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
+Boolean
+SCNetworkConnectionSuspend                     (SCNetworkConnectionRef         connection)             __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
+
+Boolean
+SCNetworkConnectionResume                      (SCNetworkConnectionRef         connection)             __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
+
 
 #pragma mark -
 #pragma mark SCNetworkConnection "VPN on Demand" SPIs
index ce21227e8f52b1c76353b62991b30a634914d05e..c751a62fb820439aec34263cf5330cbcdcc328d3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #define kUSBProductString              "USB Product Name"
 #endif
 
+#ifndef        kIOUserEthernetInterfaceRoleKey
+#define        kIOUserEthernetInterfaceRoleKey "InterfaceRole"
+#endif
+
 #include <string.h>
 #include <mach/mach.h>
 #include <net/if.h>
@@ -112,39 +116,39 @@ enum {
        kSortOtherWireless,
        kSortTethered,
        kSortWWANEthernet,
-       kSortBluetoothPAN,
-#if    !TARGET_OS_IPHONE
+       kSortBluetoothPAN_GN,
+       kSortBluetoothPAN_NAP,
+       kSortBluetoothPAN_U,
        kSortBond,
+       kSortBridge,
        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 kSCNetworkInterfaceTypeBridge                = CFSTR("Bridge");
 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 kSCNetworkInterfaceTypeLoopback      = CFSTR("Loopback");
 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 kSCNetworkInterfaceTypeVPN           = CFSTR("VPN");
 const CFStringRef kSCNetworkInterfaceTypeWWAN          = CFSTR("WWAN");
 
 const CFStringRef kSCNetworkInterfaceTypeIPv4          = CFSTR("IPv4");
 
-static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4      = {
-       INIT_CFRUNTIME_BASE(NULL, 0, 0x0080),   // cfBase
+static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4     = {
+       INIT_CFRUNTIME_BASE(),                  // cfBase
        NULL,                                   // interface type
        NULL,                                   // name
        NULL,                                   // localized name
@@ -165,6 +169,7 @@ static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4      = {
        NULL,                                   // addressString
        FALSE,                                  // builtin
        NULL,                                   // configurationAction
+       FALSE,                                  // hidden
        NULL,                                   // location
        NULL,                                   // path
        NULL,                                   // overrides
@@ -173,15 +178,58 @@ static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4      = {
        NULL,                                   // unit
        { NULL, 0, 0 },                         // usb { name, vid, pid }
        kSortUnknown,                           // sort_order
-#if    !TARGET_OS_IPHONE
        FALSE,                                  // supportsBond
-       { NULL, NULL},                          // bond { interfaces, options }
+       { NULL, NULL, NULL },                   // bond { interfaces, options, mode }
+       FALSE,                                  // supportsBridge
+       { NULL, NULL },                         // bridge { interfaces, options }
+       FALSE,                                  // supportsVLAN
+       { NULL, NULL, NULL }                    // vlan { interface, tag, options }
+};
+
+const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4    = (SCNetworkInterfaceRef)&__kSCNetworkInterfaceIPv4;
+
+static SCNetworkInterfacePrivate __kSCNetworkInterfaceLoopback = {
+       INIT_CFRUNTIME_BASE(),                  // cfBase
+       NULL,                                   // interface type
+       NULL,                                   // name
+       NULL,                                   // localized name
+       NULL,                                   // localization key
+       NULL,                                   // localization arg1
+       NULL,                                   // localization arg2
+       NULL,                                   // [layered] interface
+       NULL,                                   // prefs
+       NULL,                                   // serviceID
+       NULL,                                   // unsaved
+       NULL,                                   // entity_device
+       NULL,                                   // entity_device_unique
+       NULL,                                   // entity_type
+       NULL,                                   // entity_subtype
+       NULL,                                   // supported_interface_types
+       NULL,                                   // supported_protocol_types
+       NULL,                                   // address
+       NULL,                                   // addressString
+       FALSE,                                  // builtin
+       NULL,                                   // configurationAction
+       FALSE,                                  // hidden
+       NULL,                                   // location
+       NULL,                                   // path
+       NULL,                                   // overrides
+       FALSE,                                  // modemIsV92
+       NULL,                                   // type
+       NULL,                                   // unit
+       { NULL, 0, 0 },                         // usb { name, vid, pid }
+       kSortUnknown,                           // sort_order
+       FALSE,                                  // supportsBond
+       { NULL, NULL, NULL },                   // bond { interfaces, options, mode }
+       FALSE,                                  // supportsBridge
+       { NULL, NULL },                         // bridge { interfaces, options }
        FALSE,                                  // supportsVLAN
        { NULL, NULL, NULL }                    // vlan { interface, tag, options }
-#endif // !TARGET_OS_IPHONE
 };
 
-const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4     = (SCNetworkInterfaceRef)&__kSCNetworkInterfaceIPv4;
+const SCNetworkInterfaceRef kSCNetworkInterfaceLoopback        = (SCNetworkInterfaceRef)&__kSCNetworkInterfaceLoopback;
+
+static CFMutableSetRef vendor_interface_types  = NULL;
 
 #pragma mark -
 #pragma mark SCNetworkInterface configuration details
@@ -195,11 +243,6 @@ const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4     = (SCNetworkInterfaceRef
 #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
@@ -220,27 +263,27 @@ static const struct {
 } 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                                          },
-#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                                          },
+       { &kSCNetworkInterfaceType6to4          , &kSCEntNet6to4    , FALSE,    doNone,         NULL,                                   doIPv6                                  },
+       { &kSCNetworkInterfaceTypeBluetooth     , &kSCEntNetModem   , FALSE,    doPPP,          &kSCValNetInterfaceSubTypePPPSerial,    doNone                                  },
+       { &kSCNetworkInterfaceTypeBond          , &kSCEntNetEthernet, TRUE ,    doNone,         NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB     },
+       { &kSCNetworkInterfaceTypeBridge        , &kSCEntNetEthernet, TRUE ,    doNone,         NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB     },
+       { &kSCNetworkInterfaceTypeEthernet      , &kSCEntNetEthernet, TRUE ,    doPPP,          &kSCValNetInterfaceSubTypePPPoE,        doDNS|doIPv4|doIPv6|doProxies|doSMB     },
+       { &kSCNetworkInterfaceTypeFireWire      , &kSCEntNetFireWire, TRUE ,    doNone,         NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB     },
+       { &kSCNetworkInterfaceTypeIEEE80211     , &kSCEntNetAirPort , TRUE ,    doPPP,          &kSCValNetInterfaceSubTypePPPoE,        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                                  },
+       { &kSCNetworkInterfaceTypeVLAN          , &kSCEntNetEthernet, TRUE ,    doNone,         NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB     },
+       { &kSCNetworkInterfaceTypeVPN           , &kSCEntNetVPN     , FALSE,    doNone,         NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB     },
+       { &kSCNetworkInterfaceTypeWWAN          , &kSCEntNetModem   , FALSE,    doPPP,          &kSCValNetInterfaceSubTypePPPSerial,    doNone                                  },
        // =====================================  =================  ========== =============== ======================================= =========================================
-       { &kSCNetworkInterfaceTypeIPv4          , NULL              , FALSE,    doOverIP,       NULL,                                   doNone                                          }
+       { &kSCNetworkInterfaceTypeLoopback      , NULL              , TRUE ,    doNone,         NULL,                                   doIPv4|doIPv6                           },
+       // =====================================  =================  ========== =============== ======================================= =========================================
+       { &kSCNetworkInterfaceTypeIPv4          , NULL              , FALSE,    doOverIP,       NULL,                                   doNone                                  }
 };
 
 
@@ -319,6 +362,9 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf)
                }
        }
        CFStringAppendFormat(result, NULL, CFSTR(", builtin = %s"), interfacePrivate->builtin ? "TRUE" : "FALSE");
+       if (interfacePrivate->hidden) {
+               CFStringAppendFormat(result, NULL, CFSTR(", hidden = TRUE"));
+       }
        if (interfacePrivate->modemIsV92) {
                CFStringAppendFormat(result, NULL, CFSTR(", v.92"));
        }
@@ -347,9 +393,12 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf)
                        vid = 0;
                }
 
-               CFStringAppendFormat(result, NULL, CFSTR(", USB%s%@ vid/pid = 0x%0x/0x%0x"),
-                                    interfacePrivate->usb.name != NULL ? " name = " : "",
-                                    interfacePrivate->usb.name != NULL ? interfacePrivate->usb.name : CFSTR(""),
+               if (interfacePrivate->usb.name != NULL) {
+                       CFStringAppendFormat(result, NULL, CFSTR(", USB name = %@"),
+                                            interfacePrivate->usb.name);
+               }
+
+               CFStringAppendFormat(result, NULL, CFSTR(", USB vid/pid = 0x%0x/0x%0x"),
                                     interfacePrivate->usb.vid,
                                     interfacePrivate->usb.pid);
        }
@@ -372,7 +421,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;
@@ -394,9 +443,26 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf)
        if (interfacePrivate->bond.options != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), interfacePrivate->bond.options);
        }
-       if (interfacePrivate->bond.mode != NULL) {
-               CFStringAppendFormat(result, NULL, CFSTR(", mode = %@"), interfacePrivate->bond.mode);
+
+       if (interfacePrivate->bridge.interfaces != NULL) {
+               CFIndex i;
+               CFIndex n;
+
+               n = CFArrayGetCount(interfacePrivate->bridge.interfaces);
+               for (i = 0; i < n; i++) {
+                       SCNetworkInterfaceRef   member;
+
+                       member = CFArrayGetValueAtIndex(interfacePrivate->bridge.interfaces, i);
+                       CFStringAppendFormat(result, NULL,
+                                            CFSTR("%s%@"),
+                                            (i == 0) ? ", interfaces = " : ", ",
+                                            SCNetworkInterfaceGetBSDName(member));
+               }
+       }
+       if (interfacePrivate->bridge.options != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), interfacePrivate->bridge.options);
        }
+
        if (interfacePrivate->vlan.interface != NULL) {
                CFStringAppendFormat(result, NULL,
                                     CFSTR(", interface = %@"),
@@ -408,7 +474,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;
@@ -422,9 +488,6 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
 
        /* release resources */
 
-       if (interfacePrivate->interface != NULL)
-               CFRelease(interfacePrivate->interface);
-
        if (interfacePrivate->name != NULL)
                CFRelease(interfacePrivate->name);
 
@@ -437,6 +500,9 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
        if (interfacePrivate->localized_arg2 != NULL)
                CFRelease(interfacePrivate->localized_arg2);
 
+       if (interfacePrivate->interface != NULL)
+               CFRelease(interfacePrivate->interface);
+
        if (interfacePrivate->prefs != NULL)
                CFRelease(interfacePrivate->prefs);
 
@@ -464,15 +530,15 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
        if (interfacePrivate->addressString != NULL)
                CFRelease(interfacePrivate->addressString);
 
+       if (interfacePrivate->configurationAction != NULL)
+               CFRelease(interfacePrivate->configurationAction);
+
        if (interfacePrivate->location != NULL)
                CFRelease(interfacePrivate->location);
 
        if (interfacePrivate->path != NULL)
                CFRelease(interfacePrivate->path);
 
-       if (interfacePrivate->configurationAction != NULL)
-               CFRelease(interfacePrivate->configurationAction);
-
        if (interfacePrivate->overrides != NULL)
                CFRelease(interfacePrivate->overrides);
 
@@ -491,7 +557,6 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
        if (interfacePrivate->usb.vid != NULL)
                CFRelease(interfacePrivate->usb.vid);
 
-#if    !TARGET_OS_IPHONE
        if (interfacePrivate->bond.interfaces != NULL)
                CFRelease(interfacePrivate->bond.interfaces);
 
@@ -501,6 +566,12 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
        if (interfacePrivate->bond.options != NULL)
                CFRelease(interfacePrivate->bond.options);
 
+       if (interfacePrivate->bridge.interfaces != NULL)
+               CFRelease(interfacePrivate->bridge.interfaces);
+
+       if (interfacePrivate->bridge.options != NULL)
+               CFRelease(interfacePrivate->bridge.options);
+
        if (interfacePrivate->vlan.interface != NULL)
                CFRelease(interfacePrivate->vlan.interface);
 
@@ -509,7 +580,6 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
 
        if (interfacePrivate->vlan.options != NULL)
                CFRelease(interfacePrivate->vlan.options);
-#endif // !TARGET_OS_IPHONE
 
        return;
 }
@@ -547,7 +617,6 @@ __SCNetworkInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2)
                }
        }
 
-#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
@@ -557,6 +626,12 @@ __SCNetworkInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2)
                }
        }
 
+       if (CFEqual(if1->interface_type, kSCNetworkInterfaceTypeBridge)) {
+               if (!_SC_CFEqual(if1->bridge.interfaces, if2->bridge.interfaces)) {
+                       return FALSE; // if not the same interfaces
+               }
+       }
+
        if (CFEqual(if1->interface_type, kSCNetworkInterfaceTypeVLAN)) {
                if (!_SC_CFEqual(if1->vlan.interface, if2->vlan.interface)) {
                        return FALSE;   // if not the same physical interface
@@ -565,7 +640,6 @@ __SCNetworkInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2)
                        return FALSE;   // if not the same tag
                }
        }
-#endif // !TARGET_OS_IPHONE
 
        if (!_SC_CFEqual(if1->interface, if2->interface)) {
                return FALSE;   // if not the same layering
@@ -608,10 +682,17 @@ __SCNetworkInterfaceInitialize(void)
        __kSCNetworkInterfaceTypeID = _CFRuntimeRegisterClass(&__SCNetworkInterfaceClass);
 
        // initialize __kSCNetworkInterfaceIPv4
-       _CFRuntimeSetInstanceTypeID(&__kSCNetworkInterfaceIPv4, __kSCNetworkInterfaceTypeID);
+       _CFRuntimeInitStaticInstance(&__kSCNetworkInterfaceIPv4, __kSCNetworkInterfaceTypeID);
        __kSCNetworkInterfaceIPv4.interface_type = kSCNetworkInterfaceTypeIPv4;
        __kSCNetworkInterfaceIPv4.localized_key  = CFSTR("ipv4");
 
+       // initialize __kSCNetworkInterfaceLoopback
+       _CFRuntimeInitStaticInstance(&__kSCNetworkInterfaceLoopback, __kSCNetworkInterfaceTypeID);
+       __kSCNetworkInterfaceLoopback.interface_type = kSCNetworkInterfaceTypeLoopback;
+       __kSCNetworkInterfaceLoopback.localized_key  = CFSTR("loopback");
+       __kSCNetworkInterfaceLoopback.entity_device  = CFRetain(CFSTR("lo0"));
+       __kSCNetworkInterfaceLoopback.entity_type    = kSCValNetInterfaceTypeLoopback;
+
        // get CFBundleRef for SystemConfiguration.framework
        bundle = _SC_CFBundleGet();
 
@@ -682,22 +763,25 @@ __SCNetworkInterfaceCreatePrivate(CFAllocatorRef  allocator,
        interfacePrivate->usb.vid                       = NULL;
        interfacePrivate->usb.pid                       = 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->supportsBridge                = FALSE;
+       interfacePrivate->bridge.interfaces             = NULL;
+       interfacePrivate->bridge.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)
@@ -792,6 +876,35 @@ _SCBondInterfaceCreatePrivate(CFAllocatorRef       allocator,
 }
 
 
+__private_extern__
+SCNetworkInterfacePrivateRef
+_SCBridgeInterfaceCreatePrivate(CFAllocatorRef allocator,
+                               CFStringRef     bridge_if)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+
+       interfacePrivate = __SCNetworkInterfaceCreatePrivate(allocator, NULL, NULL, NULL, NULL);
+       if (interfacePrivate == NULL) {
+               return NULL;
+       }
+
+       interfacePrivate->interface_type        = kSCNetworkInterfaceTypeBridge;
+       interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
+       interfacePrivate->entity_device         = CFStringCreateCopy(allocator, bridge_if);
+       interfacePrivate->builtin               = TRUE;
+       interfacePrivate->supportsVLAN          = __SCNetworkInterfaceSupportsVLAN(bridge_if);
+       interfacePrivate->sort_order            = kSortBridge;
+
+       interfacePrivate->localized_key         = CFSTR("bridge");
+       interfacePrivate->localized_arg1        = CFRetain(interfacePrivate->entity_device);
+
+       interfacePrivate->bridge.interfaces     = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);
+//     interfacePrivate->bridge.options        = NULL;
+
+       return interfacePrivate;
+}
+
+
 __private_extern__
 SCNetworkInterfacePrivateRef
 _SCVLANInterfaceCreatePrivate(CFAllocatorRef           allocator,
@@ -819,7 +932,6 @@ _SCVLANInterfaceCreatePrivate(CFAllocatorRef                allocator,
 
        return interfacePrivate;
 }
-#endif // !TARGET_OS_IPHONE
 
 
 #pragma mark -
@@ -1431,6 +1543,38 @@ typedef Boolean (*processInterface)(SCNetworkInterfacePrivateRef interfacePrivat
                                    CFDictionaryRef                     bus_dict);
 
 
+static void
+merge_override(SCNetworkInterfacePrivateRef    interfacePrivate,
+              io_registry_entry_t              interface,
+              CFStringRef                      override)
+{
+       CFStringRef     key;
+       CFTypeRef       val;
+
+       key = CFStringCreateWithFormat(NULL, NULL, CFSTR("Device%@Overrides"), override);
+       val = IORegistryEntrySearchCFProperty(interface,
+                                             kIOServicePlane,
+                                             key,
+                                             NULL,
+                                             kIORegistryIterateRecursively | kIORegistryIterateParents);
+       CFRelease(key);
+       if (val != NULL) {
+               if (isA_CFDictionary(val)) {
+                       if (interfacePrivate->overrides == NULL) {
+                               interfacePrivate->overrides = CFDictionaryCreateMutable(NULL,
+                                                                                       0,
+                                                                                       &kCFTypeDictionaryKeyCallBacks,
+                                                                                       &kCFTypeDictionaryValueCallBacks);
+                       }
+                       CFDictionarySetValue(interfacePrivate->overrides, override, val);
+               }
+               CFRelease(val);
+       }
+
+       return;
+}
+
+
 static Boolean
 processNetworkInterface(SCNetworkInterfacePrivateRef   interfacePrivate,
                        io_registry_entry_t             interface,
@@ -1470,7 +1614,7 @@ processNetworkInterface(SCNetworkInterfacePrivateRef      interfacePrivate,
                        } else if (IOObjectConformsTo(controller, "IOBluetoothBNEPDriver")) {
                                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
                                interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
-                               interfacePrivate->sort_order            = kSortBluetoothPAN;
+                               interfacePrivate->sort_order            = kSortBluetoothPAN_GN;
                        } else if (IOObjectConformsTo(controller, "AppleUSBEthernetHost")) {
                                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
                                interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
@@ -1479,26 +1623,60 @@ processNetworkInterface(SCNetworkInterfacePrivateRef    interfacePrivate,
                                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
                                interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
                                interfacePrivate->sort_order            = kSortWWANEthernet;
-                       } else {
+                       }
+
+                       if (interfacePrivate->interface_type == NULL) {
+                               val = IORegistryEntrySearchCFProperty(interface,
+                                                                     kIOServicePlane,
+                                                                     CFSTR(kIOUserEthernetInterfaceRoleKey),
+                                                                     NULL,
+                                                                     kIORegistryIterateRecursively | kIORegistryIterateParents);
+                               if (val != NULL) {
+                                       if (isA_CFString(val)) {
+                                               if (CFEqual(val, CFSTR("Bluetooth PAN"))) {
+                                                       interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
+                                                       interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
+                                                       interfacePrivate->sort_order            = kSortBluetoothPAN_GN;
+                                               } else if (CFEqual(val, CFSTR("Bluetooth PAN-NAP"))) {
+                                                       interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
+                                                       interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
+                                                       interfacePrivate->sort_order            = kSortBluetoothPAN_NAP;
+                                               } else if (CFEqual(val, CFSTR("Bluetooth P2P"))) {
+                                                       interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
+                                                       interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
+                                                       interfacePrivate->sort_order            = kSortBluetoothPAN_U;
+                                               }
+                                       }
+
+                                       CFRelease(val);
+                               }
+                       }
+
+                       if (interfacePrivate->interface_type == NULL) {
                                str = IODictionaryCopyCFStringValue(bus_dict, CFSTR("name"));
-                               if ((str != NULL) && CFEqual(str, CFSTR("radio"))) {
-                                       interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;      // ??
-                                       interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
-                                       interfacePrivate->sort_order            = kSortOtherWireless;
-                               } else {
-                                       interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
-                                       interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
-                                       interfacePrivate->sort_order            = kSortEthernet;
+                               if (str != NULL) {
+                                       if (CFEqual(str, CFSTR("radio"))) {
+                                               interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;      // ??
+                                               interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
+                                               interfacePrivate->sort_order            = kSortOtherWireless;
+                                       }
 
-#if    !TARGET_OS_IPHONE
-                                       // BOND support only enabled for ethernet devices
-                                       interfacePrivate->supportsBond = TRUE;
-#endif // !TARGET_OS_IPHONE
+                                       CFRelease(str);
                                }
+                       }
+
+                       if (interfacePrivate->interface_type == NULL) {
+                               interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
+                               interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
+                               interfacePrivate->sort_order            = kSortEthernet;
 
-                               if (str != NULL) CFRelease(str);
+                               // BOND support only enabled for ethernet devices
+                               interfacePrivate->supportsBond = TRUE;
                        }
 
+                       // enable Bridge support
+                       interfacePrivate->supportsBridge = TRUE;
+
                        // built-in
                        val = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOBuiltin)));
                        if (val == NULL) {
@@ -1519,7 +1697,6 @@ processNetworkInterface(SCNetworkInterfacePrivateRef      interfacePrivate,
                        // location
                        interfacePrivate->location = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOLocation));
 
-#if    !TARGET_OS_IPHONE
                        // VLAN support
                        num = CFDictionaryGetValue(controller_dict, CFSTR(kIOFeatures));
                        if (isA_CFNumber(num) &&
@@ -1528,13 +1705,16 @@ processNetworkInterface(SCNetworkInterfacePrivateRef    interfacePrivate,
                                        interfacePrivate->supportsVLAN = TRUE;
                                }
                        }
-#endif // !TARGET_OS_IPHONE
 
                        // localized name
                        if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeIEEE80211)) {
                                interfacePrivate->localized_key = CFSTR("airport");
-                       } else if (interfacePrivate->sort_order == kSortBluetoothPAN) {
-                               interfacePrivate->localized_key  = CFSTR("bluetooth-pan");
+                       } else if (interfacePrivate->sort_order == kSortBluetoothPAN_GN) {
+                               interfacePrivate->localized_key  = CFSTR("bluetooth-pan-gn");
+                       } else if (interfacePrivate->sort_order == kSortBluetoothPAN_NAP) {
+                               interfacePrivate->localized_key  = CFSTR("bluetooth-pan-nap");
+                       } else if (interfacePrivate->sort_order == kSortBluetoothPAN_U) {
+                               interfacePrivate->localized_key  = CFSTR("bluetooth-pan-u");
                        } else if (interfacePrivate->sort_order == kSortOtherWireless) {
                                interfacePrivate->localized_key  = CFSTR("wireless");
                                interfacePrivate->localized_arg1 = CFRetain(CFSTR(""));         // ??
@@ -1676,6 +1856,9 @@ processNetworkInterface(SCNetworkInterfacePrivateRef      interfacePrivate,
                interfacePrivate->unit = CFRetain(num);
        }
 
+       // configuration [PPP] template override (now deprecated, use NetworkConfigurationOverrides)
+       merge_override(interfacePrivate, interface, kSCNetworkInterfaceTypePPP);
+
        return TRUE;
 }
 
@@ -1812,7 +1995,7 @@ processSerialInterface(SCNetworkInterfacePrivateRef       interfacePrivate,
        // check if hidden
        val = IORegistryEntrySearchCFProperty(interface,
                                              kIOServicePlane,
-                                             CFSTR("HiddenPort"),
+                                             kSCNetworkInterfaceHiddenPortKey,
                                              NULL,
                                              kIORegistryIterateRecursively | kIORegistryIterateParents);
        if (val != NULL) {
@@ -1823,7 +2006,7 @@ processSerialInterface(SCNetworkInterfacePrivateRef       interfacePrivate,
        // check if initializing
        val = IORegistryEntrySearchCFProperty(interface,
                                              kIOServicePlane,
-                                             CFSTR("Initializing"),
+                                             kSCNetworkInterfaceInitializingKey,
                                              NULL,
                                              kIORegistryIterateRecursively | kIORegistryIterateParents);
        if (val != NULL) {
@@ -1939,41 +2122,17 @@ processSerialInterface(SCNetworkInterfacePrivateRef     interfacePrivate,
                goto done;
        }
 
-       // configuration template overrides
-       val = IORegistryEntrySearchCFProperty(interface,
-                                             kIOServicePlane,
-                                             CFSTR("DevicePPPOverrides"),
-                                             NULL,
-                                             kIORegistryIterateRecursively | kIORegistryIterateParents);
-       if (val != NULL) {
-               if (isA_CFDictionary(val)) {
-                       if (interfacePrivate->overrides == NULL) {
-                               interfacePrivate->overrides = CFDictionaryCreateMutable(NULL,
-                                                                                       0,
-                                                                                       &kCFTypeDictionaryKeyCallBacks,
-                                                                                       &kCFTypeDictionaryValueCallBacks);
-                       }
-                       CFDictionarySetValue(interfacePrivate->overrides, kSCNetworkInterfaceTypePPP, val);
-               }
-               CFRelease(val);
-       }
+       // configuration [PPP] template override   (now deprecated, use NetworkConfigurationOverrides)
+       merge_override(interfacePrivate, interface, kSCNetworkInterfaceTypePPP);
 
-       val = IORegistryEntrySearchCFProperty(interface,
-                                             kIOServicePlane,
-                                             CFSTR("DeviceModemOverrides"),
-                                             NULL,
-                                             kIORegistryIterateRecursively | kIORegistryIterateParents);
-       if (val != NULL) {
-               if (isA_CFDictionary(val)) {
-                       CFStringRef     uniqueID;
+       // configuration [Modem] template override (now deprecated, use NetworkConfigurationOverrides)
+       merge_override(interfacePrivate, interface, kSCNetworkInterfaceTypeModem);
 
-                       if (interfacePrivate->overrides == NULL) {
-                               interfacePrivate->overrides = CFDictionaryCreateMutable(NULL,
-                                                                                       0,
-                                                                                       &kCFTypeDictionaryKeyCallBacks,
-                                                                                       &kCFTypeDictionaryValueCallBacks);
-                       }
-                       CFDictionarySetValue(interfacePrivate->overrides, kSCNetworkInterfaceTypeModem, val);
+       // look for modem CCL, unique identifier
+       if (interfacePrivate->overrides != NULL) {
+               val = CFDictionaryGetValue(interfacePrivate->overrides, kSCNetworkInterfaceTypeModem);
+               if (val != NULL) {
+                       CFStringRef     uniqueID;
 
                        modemCCL = CFDictionaryGetValue(val, kSCPropNetModemConnectionScript);
                        modemCCL = isA_CFString(modemCCL);
@@ -1987,10 +2146,10 @@ processSerialInterface(SCNetworkInterfacePrivateRef     interfacePrivate,
                                interfacePrivate->entity_device_unique = CFStringCreateCopy(NULL, uniqueID);
                        }
                }
-               CFRelease(val);
        }
 
-       // if not part of the DeviceModemOverrides, look harder for the modem CCL
+       // if not part of the NetworkConfigurationOverrides/DeviceModemOverrides, look
+       // a bit harder for the modem CCL
        if (modemCCL == NULL) {
                val = IORegistryEntrySearchCFProperty(interface,
                                                      kIOServicePlane,
@@ -2133,6 +2292,7 @@ createInterface(io_registry_entry_t interface, processInterface func)
        CFMutableDictionaryRef          interface_dict          = NULL;
        kern_return_t                   kr;
        io_string_t                     path;
+       CFTypeRef                       val;
 
        kr = IORegistryEntryGetPath(interface, kIOServicePlane, path);
        if (kr != kIOReturnSuccess) {
@@ -2176,10 +2336,21 @@ 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)) {
-               CFTypeRef       val;
+       // configuration [PPP, Modem, DNS, IPv4, IPv6, Proxies, SMB] template overrides
+       val = IORegistryEntrySearchCFProperty(interface,
+                                             kIOServicePlane,
+                                             kSCNetworkInterfaceNetworkConfigurationOverridesKey,
+                                             NULL,
+                                             kIORegistryIterateRecursively | kIORegistryIterateParents);
+       if (val != NULL) {
+               if (isA_CFDictionary(val)) {
+                       interfacePrivate->overrides = CFDictionaryCreateMutableCopy(NULL, 0, val);
+               }
+               CFRelease(val);
+       }
 
-               /* check user-notification / auto-configuration preferences */
+       if ((*func)(interfacePrivate, interface, interface_dict, controller, controller_dict, bus, bus_dict)) {
+               /* get user-notification / auto-configuration preference */
                val = IORegistryEntrySearchCFProperty(interface,
                                                      kIOServicePlane,
                                                      kSCNetworkInterfaceConfigurationActionKey,
@@ -2191,6 +2362,17 @@ createInterface(io_registry_entry_t interface, processInterface func)
                        }
                        CFRelease(val);
                }
+
+               /* get HiddenConfiguration preference */
+               val = IORegistryEntrySearchCFProperty(interface,
+                                                     kIOServicePlane,
+                                                     kSCNetworkInterfaceHiddenConfigurationKey,
+                                                     NULL,
+                                                     kIORegistryIterateRecursively | kIORegistryIterateParents);
+               if (val != NULL) {
+                       interfacePrivate->hidden = TRUE;
+                       CFRelease(val);
+               }
        } else {
                CFRelease(interfacePrivate);
                interfacePrivate = NULL;
@@ -2218,6 +2400,13 @@ findMatchingInterfaces(CFDictionaryRef matching, processInterface func)
        kern_return_t           kr;
        io_iterator_t           iterator        = MACH_PORT_NULL;
 
+       /*
+        * A reference to the "matching" dictionary will be consumed by the
+        * the call to IOServiceGetMatchingServices so we bump up the retain
+        * count.
+        */
+       CFRetain(matching);
+
        kr = IOServiceGetMatchingServices(masterPort, matching, &iterator);
        if (kr != kIOReturnSuccess) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("findMatchingInterfaces IOServiceGetMatchingServices() failed, kr = 0x%x"), kr);
@@ -2613,6 +2802,11 @@ __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface)
                                     CFSTR("DeviceUniqueIdentifier"),
                                     interfacePrivate->entity_device_unique);
        }
+       if (interfacePrivate->hidden) {
+               CFDictionarySetValue(entity,
+                                    kSCNetworkInterfaceHiddenConfigurationKey,
+                                    kCFBooleanTrue);
+       }
 
        // match the "hardware" with the lowest layer
        while (TRUE) {
@@ -2667,7 +2861,6 @@ __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface)
 }
 
 
-#if    !TARGET_OS_IPHONE
 static SCNetworkInterfaceRef
 findInterface(CFArrayRef interfaces, CFStringRef match_if)
 {
@@ -2689,7 +2882,6 @@ findInterface(CFArrayRef interfaces, CFStringRef match_if)
        return NULL;
 }
 
-
 static SCNetworkInterfaceRef
 findBondInterface(SCPreferencesRef prefs, CFStringRef ifDevice)
 {
@@ -2709,6 +2901,25 @@ findBondInterface(SCPreferencesRef prefs, CFStringRef ifDevice)
        return interface;
 }
 
+static SCNetworkInterfaceRef
+findBridgeInterface(SCPreferencesRef prefs, CFStringRef ifDevice)
+{
+       CFArrayRef              bridges;
+       SCNetworkInterfaceRef   interface       = NULL;
+
+       if (prefs == NULL) {
+               return (NULL);
+       }
+
+       // check if the interface is an bridge
+       bridges = SCBridgeInterfaceCopyAll(prefs);
+       if (bridges != NULL) {
+               interface = findInterface(bridges, ifDevice);
+               CFRelease(bridges);
+       }
+       return interface;
+}
+
 static SCNetworkInterfaceRef
 findVLANInterface(SCPreferencesRef prefs, CFStringRef ifDevice)
 {
@@ -2727,7 +2938,6 @@ findVLANInterface(SCPreferencesRef prefs, CFStringRef ifDevice)
        }
        return interface;
 }
-#endif // !TARGET_OS_IPHONE
 
 
 SCNetworkInterfaceRef
@@ -2743,14 +2953,19 @@ _SCNetworkInterfaceCreateWithBSDName(CFAllocatorRef             allocator,
                                           &kCFTypeDictionaryKeyCallBacks,
                                           &kCFTypeDictionaryValueCallBacks);
        CFDictionarySetValue(entity, kSCPropNetInterfaceDeviceName, bsdName);
-#if    !TARGET_OS_IPHONE
+
        if ((flags & kIncludeBondInterfaces) == 0) {
                CFDictionarySetValue(entity, CFSTR("_NO_BOND_INTERFACES_"), kCFBooleanTrue);
        }
+
+       if ((flags & kIncludeBridgeInterfaces) == 0) {
+               CFDictionarySetValue(entity, CFSTR("_NO_BRIDGE_INTERFACES_"), kCFBooleanTrue);
+       }
+
        if ((flags & kIncludeVLANInterfaces) == 0) {
                CFDictionarySetValue(entity, CFSTR("_NO_VLAN_INTERFACES_"), kCFBooleanTrue);
        }
-#endif // !TARGET_OS_IPHONE
+
        interface = _SCNetworkInterfaceCreateWithEntity(NULL, entity, NULL);
        CFRelease(entity);
 
@@ -2861,7 +3076,8 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef                allocator,
        }
 
        ifSubType = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceSubType);
-       if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
+       if (CFEqual(ifType, kSCValNetInterfaceTypePPP) ||
+           CFEqual(ifType, kSCValNetInterfaceTypeVPN)) {
                if (!isA_CFString(ifSubType)) {
                        return NULL;
                }
@@ -2873,14 +3089,19 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef              allocator,
        if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet) ||
            CFEqual(ifType, kSCValNetInterfaceTypeFireWire) ||
            (CFEqual(ifType, kSCValNetInterfaceTypePPP) && CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPoE))) {
-               char                    bsdName[IFNAMSIZ + 1];
+               char                    bsdName[IFNAMSIZ];
                CFMutableDictionaryRef  matching;
 
                if (!isA_CFString(ifDevice)) {
                        return NULL;
                }
 
-               if (_SC_cfstring_to_cstring(ifDevice, bsdName, sizeof(bsdName), kCFStringEncodingASCII) == NULL) {
+               if (CFEqual(ifDevice, CFSTR("lo0"))) {  // for _SCNetworkInterfaceCreateWithBSDName
+                       interfacePrivate = __SCNetworkInterfaceCreateCopy(NULL, kSCNetworkInterfaceLoopback, NULL, NULL);
+                       goto done;
+               }
+
+               if (_SC_cfstring_to_cstring(ifDevice, bsdName, sizeof(bsdName), kCFStringEncodingASCII) == NULL) {
                        goto done;
                }
 
@@ -2888,10 +3109,8 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef               allocator,
                if (matching == NULL) {
                        goto done;
                }
-
-               // note: the "matching" dictionary will be consumed by the following
                matching_interfaces = findMatchingInterfaces(matching, processNetworkInterface);
-
+               CFRelease(matching);
        } else if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
                if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPSerial)) {
                        CFDictionaryRef matching;
@@ -2914,9 +3133,8 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef                allocator,
                                                      sizeof(match_keys)/sizeof(match_keys[0]),
                                                      &kCFTypeDictionaryKeyCallBacks,
                                                      &kCFTypeDictionaryValueCallBacks);
-
-                       // note: the "matching" dictionary will be consumed by the following
                        matching_interfaces = findMatchingInterfaces(matching, processSerialInterface);
+                       CFRelease(matching);
 
                        if (ifUnique == NULL) {
                                CFIndex n;
@@ -2949,9 +3167,8 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef                allocator,
                                                                      sizeof(match_keys)/sizeof(match_keys[0]),
                                                                      &kCFTypeDictionaryKeyCallBacks,
                                                                      &kCFTypeDictionaryValueCallBacks);
-
-                                       // note: the "matching" dictionary will be consumed by the following
                                        matching_interfaces = findMatchingInterfaces(matching, processSerialInterface);
+                                       CFRelease(matching);
                                }
                        }
                } else if (CFEqual(ifSubType, kSCValNetInterfaceSubTypeL2TP)) {
@@ -2975,6 +3192,13 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef               allocator,
        } else if (CFEqual(ifType, kSCValNetInterfaceTypeIPSec)) {
                interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
                                                                                                       kSCNetworkInterfaceTypeIPSec);
+       } else if (CFEqual(ifType, kSCValNetInterfaceTypeLoopback)) {
+               interfacePrivate = __SCNetworkInterfaceCreateCopy(NULL, kSCNetworkInterfaceLoopback, NULL, NULL);
+       } else if (CFEqual(ifType, kSCValNetInterfaceTypeVPN)) {
+               if (CFStringFind(ifSubType, CFSTR("."), 0).location != kCFNotFound) {
+                       interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
+                                                                                                              ifSubType);
+               }
        } else if ((CFStringFind(ifType, CFSTR("."), 0).location != kCFNotFound) && (ifDevice == NULL)) {
                interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
                                                                                                       ifType);
@@ -3004,15 +3228,19 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef              allocator,
                                if (prefs == NULL) {
                                        break;
                                }
-#if    !TARGET_OS_IPHONE
-                               if (!CFDictionaryContainsKey(interface_entity, CFSTR("_NO_VLAN_INTERFACES_"))) {
-                                       interfacePrivate = (SCNetworkInterfacePrivateRef)findVLANInterface(prefs, ifDevice);
+                               if (!CFDictionaryContainsKey(interface_entity, CFSTR("_NO_BOND_INTERFACES_"))) {
+                                       interfacePrivate = (SCNetworkInterfacePrivateRef)findBondInterface(prefs, ifDevice);
                                }
+
                                if ((interfacePrivate == NULL)
-                                   && !CFDictionaryContainsKey(interface_entity, CFSTR("_NO_BOND_INTERFACES_"))) {
-                                       interfacePrivate = (SCNetworkInterfacePrivateRef)findBondInterface(prefs, ifDevice);
+                                   && !CFDictionaryContainsKey(interface_entity, CFSTR("_NO_BRIDGE_INTERFACES_"))) {
+                                       interfacePrivate = (SCNetworkInterfacePrivateRef)findBridgeInterface(prefs, ifDevice);
+                               }
+
+                               if ((interfacePrivate == NULL)
+                                   && !CFDictionaryContainsKey(interface_entity, CFSTR("_NO_VLAN_INTERFACES_"))) {
+                                       interfacePrivate = (SCNetworkInterfacePrivateRef)findVLANInterface(prefs, ifDevice);
                                }
-#endif // !TARGET_OS_IPHONE
                                CFRelease(prefs);
                                break;
                        default :
@@ -3093,6 +3321,7 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef                allocator,
                        if (isA_CFString((entity_hardware)) &&
                            CFEqual(entity_hardware, kSCEntNetAirPort)) {
                                interfacePrivate->interface_type = kSCNetworkInterfaceTypeIEEE80211;
+                               interfacePrivate->localized_key  = CFSTR("airport");
                                interfacePrivate->sort_order     = kSortAirPort;
                        } else {
                                CFStringRef     name;
@@ -3101,9 +3330,17 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef               allocator,
 
                                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;
+                                       interfacePrivate->localized_key = CFSTR("iPhone");
+                                       interfacePrivate->sort_order    = kSortTethered;
+                               } else if (_SCNetworkInterfaceMatchesName(name, CFSTR("bluetooth-pan-gn"))) {
+                                       interfacePrivate->localized_key = CFSTR("bluetooth-pan-gn");
+                                       interfacePrivate->sort_order    = kSortBluetoothPAN_GN;
+                               } else if (_SCNetworkInterfaceMatchesName(name, CFSTR("bluetooth-pan-nap"))) {
+                                       interfacePrivate->localized_key = CFSTR("bluetooth-pan-nap");
+                                       interfacePrivate->sort_order    = kSortBluetoothPAN_NAP;
+                               } else if (_SCNetworkInterfaceMatchesName(name, CFSTR("bluetooth-pan-u"))) {
+                                       interfacePrivate->localized_key = CFSTR("bluetooth-pan-u");
+                                       interfacePrivate->sort_order    = kSortBluetoothPAN_U;
                                } else {
                                        interfacePrivate->sort_order = kSortEthernet;
                                }
@@ -3139,26 +3376,50 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef              allocator,
                                        interfacePrivate->sort_order     = kSortModem;
                                }
                        } else {
+                               SCNetworkInterfaceRef   child;
+
                                // PPTP, L2TP, ...
                                CFRelease(interfacePrivate);
-                               interfacePrivate = (SCNetworkInterfacePrivateRef)kSCNetworkInterfaceIPv4;
-                               CFRetain(interfacePrivate);
+                               child = SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4, ifSubType);
+                               interfacePrivate = (SCNetworkInterfacePrivateRef)child;
+                               if (interfacePrivate == NULL) {
+                                       return NULL;
+                               }
+                       }
+               } else if (CFEqual(ifType, kSCValNetInterfaceTypeVPN)) {
+                       SCNetworkInterfaceRef   child;
+
+                       CFRelease(interfacePrivate);
+                       child = SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4, ifSubType);
+                       interfacePrivate = (SCNetworkInterfacePrivateRef)child;
+                       if (interfacePrivate == NULL) {
+                               return NULL;
                        }
                } else if (CFStringFind(ifType, CFSTR("."), 0).location != kCFNotFound) {
                        // if vendor interface
-                       interfacePrivate->interface_type = ifType;
+                       if (vendor_interface_types == NULL) {
+                               vendor_interface_types = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+                       }
+                       CFSetAddValue(vendor_interface_types, ifType);
+
+                       interfacePrivate->interface_type = CFSetGetValue(vendor_interface_types, ifType);
                } else {
                        // if unknown interface
                        CFRelease(interfacePrivate);
                        interfacePrivate = NULL;
+                       return NULL;
+               }
+
+               if (CFDictionaryContainsKey(interface_entity, kSCNetworkInterfaceHiddenConfigurationKey)) {
+                       interfacePrivate->hidden = TRUE;
                }
        }
 
-       if ((interfacePrivate != NULL) && (service != NULL)) {
+       if (service != NULL) {
                __SCNetworkInterfaceSetService((SCNetworkInterfaceRef)interfacePrivate,
                                               service);
-#if    !TARGET_OS_IPHONE
-               // set prefs & serviceID to VLANs and Bonds
+
+               // set prefs & serviceID to Bond member interfaces
                if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeBond)) {
                        CFIndex         i;
                        CFArrayRef      members;
@@ -3172,7 +3433,26 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef               allocator,
                                member = CFArrayGetValueAtIndex(members, i);
                                __SCNetworkInterfaceSetService(member, service);
                        }
-               } else if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeVLAN)) {
+               }
+
+               // set prefs & serviceID to Bridge member interfaces
+               if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeBridge)) {
+                       CFIndex         i;
+                       CFArrayRef      members;
+                       CFIndex         n;
+
+                       members = SCBridgeInterfaceGetMemberInterfaces((SCNetworkInterfaceRef)interfacePrivate);
+                       n = (members != NULL) ? CFArrayGetCount(members) : 0;
+                       for (i = 0; i < n; i++) {
+                               SCNetworkInterfaceRef   member;
+
+                               member = CFArrayGetValueAtIndex(members, i);
+                               __SCNetworkInterfaceSetService(member, service);
+                       }
+               }
+
+               // set prefs & serviceID to VLAN pyhsical interface
+               if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeVLAN)) {
                        SCNetworkInterfaceRef   vlan_physical;
 
                        vlan_physical = SCVLANInterfaceGetPhysicalInterface((SCNetworkInterfaceRef)interfacePrivate);
@@ -3180,7 +3460,6 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef                allocator,
                                __SCNetworkInterfaceSetService(vlan_physical, service);
                        }
                }
-#endif // !TARGET_OS_IPHONE
        }
 
        if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
@@ -3191,6 +3470,14 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef               allocator,
                                                               kSCNetworkInterfaceTypePPP);
                CFRelease(interfacePrivate);
                interfacePrivate = (SCNetworkInterfacePrivateRef)parent;
+       } else if (CFEqual(ifType, kSCValNetInterfaceTypeVPN)) {
+               SCNetworkInterfaceRef   parent;
+
+               // create parent
+               parent = SCNetworkInterfaceCreateWithInterface((SCNetworkInterfaceRef)interfacePrivate,
+                                                              kSCNetworkInterfaceTypeVPN);
+               CFRelease(interfacePrivate);
+               interfacePrivate = (SCNetworkInterfacePrivateRef)parent;
        }
 
        return (SCNetworkInterfaceRef)interfacePrivate;
@@ -3212,6 +3499,7 @@ __SCNetworkInterfaceCopyAll_IONetworkInterface(void)
 
        matching = IOServiceMatching(kIONetworkInterfaceClass);
        new_interfaces = findMatchingInterfaces(matching, processNetworkInterface);
+       CFRelease(matching);
 
        return new_interfaces;
 }
@@ -3239,6 +3527,7 @@ __SCNetworkInterfaceCopyAll_Modem()
                                      &kCFTypeDictionaryKeyCallBacks,
                                      &kCFTypeDictionaryValueCallBacks);
        new_interfaces = findMatchingInterfaces(matching, processSerialInterface);
+       CFRelease(matching);
 
        return new_interfaces;
 }
@@ -3266,6 +3555,7 @@ __SCNetworkInterfaceCopyAll_RS232()
                                      &kCFTypeDictionaryKeyCallBacks,
                                      &kCFTypeDictionaryValueCallBacks);
        new_interfaces = findMatchingInterfaces(matching, processSerialInterface);
+       CFRelease(matching);
 
        return new_interfaces;
 }
@@ -3357,13 +3647,11 @@ __waitForInterfaces()
 
 
 CFArrayRef /* of SCNetworkInterfaceRef's */
-SCNetworkInterfaceCopyAll()
+_SCNetworkInterfaceCopyAllWithPreferences(SCPreferencesRef prefs)
 {
        CFMutableArrayRef       all_interfaces;
        CFArrayRef              new_interfaces;
-#if    !TARGET_OS_IPHONE
-       SCPreferencesRef        prefs;
-#endif // !TARGET_OS_IPHONE
+       Boolean                 temp_preferences        = FALSE;
 
        /* initialize runtime */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
@@ -3394,9 +3682,13 @@ SCNetworkInterfaceCopyAll()
                CFRelease(new_interfaces);
        }
 
-#if    !TARGET_OS_IPHONE
-       // get virtual network interfaces (Bond, VLAN)
-       prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkInterfaceCopyAll"), NULL);
+       // get virtual network interfaces (Bond, Bridge, VLAN)
+       if (prefs == NULL) {
+               prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkInterfaceCopyAll"), NULL);
+               if (prefs != NULL) {
+                       temp_preferences = TRUE;
+               }
+       }
        if (prefs != NULL) {
                new_interfaces = SCBondInterfaceCopyAll(prefs);
                if (new_interfaces != NULL) {
@@ -3404,15 +3696,20 @@ SCNetworkInterfaceCopyAll()
                        CFRelease(new_interfaces);
                }
 
+               new_interfaces = SCBridgeInterfaceCopyAll(prefs);
+               if (new_interfaces != NULL) {
+                       add_interfaces(all_interfaces, new_interfaces);
+                       CFRelease(new_interfaces);
+               }
+
                new_interfaces = SCVLANInterfaceCopyAll(prefs);
                if (new_interfaces != NULL) {
                        add_interfaces(all_interfaces, new_interfaces);
                        CFRelease(new_interfaces);
                }
 
-               CFRelease(prefs);
+               if (temp_preferences) CFRelease(prefs);
        }
-#endif // !TARGET_OS_IPHONE
 
        // all interfaces have been identified, order and return
        sort_interfaces(all_interfaces);
@@ -3421,6 +3718,16 @@ SCNetworkInterfaceCopyAll()
 }
 
 
+CFArrayRef /* of SCNetworkInterfaceRef's */
+SCNetworkInterfaceCopyAll()
+{
+       CFArrayRef      all_interfaces;
+
+       all_interfaces = _SCNetworkInterfaceCopyAllWithPreferences(NULL);
+       return all_interfaces;
+}
+
+
 CFArrayRef /* of kSCNetworkInterfaceTypeXXX CFStringRef's */
 SCNetworkInterfaceGetSupportedInterfaceTypes(SCNetworkInterfaceRef interface)
 {
@@ -3456,6 +3763,14 @@ SCNetworkInterfaceGetSupportedInterfaceTypes(SCNetworkInterfaceRef interface)
                                CFArrayAppendValue(interfacePrivate->supported_interface_types, kSCNetworkInterfaceTypeIPSec);
                        }
                }
+       } else {
+               SCNetworkInterfaceRef   child;
+
+               child = SCNetworkInterfaceGetInterface(interface);
+               if ((child != NULL) && CFEqual(child, kSCNetworkInterfaceIPv4)) {
+                       interfacePrivate->supported_interface_types = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+                       CFArrayAppendValue(interfacePrivate->supported_interface_types, kSCNetworkInterfaceTypeVPN);
+               }
        }
 
     done :
@@ -3483,11 +3798,6 @@ 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);
                        }
@@ -3531,6 +3841,12 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
                return NULL;
        }
 
+       if (CFEqual(child, kSCNetworkInterfaceLoopback)) {
+               // can't layer on top of loopback
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
        childIndex = findConfiguration(childPrivate->interface_type);
 
        parentPrivate = __SCNetworkInterfaceCreatePrivate(NULL,
@@ -3605,10 +3921,60 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
                parentPrivate->interface_type = kSCNetworkInterfaceTypeIPSec;
                parentPrivate->localized_key  = CFSTR("ipsec");
                parentPrivate->entity_type    = kSCValNetInterfaceTypeIPSec;
+       } else  if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVPN)) {
+               if (childIndex != kCFNotFound) {
+                       // if not a "vendor" child interface
+                       goto fail;
+               }
+
+               parentPrivate->interface_type = kSCNetworkInterfaceTypeVPN;
+               parentPrivate->localized_key  = CFSTR("vpn");
+               parentPrivate->localized_arg1 = CFRetain(childPrivate->entity_type);
+               parentPrivate->entity_type    = kSCValNetInterfaceTypeVPN;
+               parentPrivate->entity_subtype = childPrivate->entity_type;
+               if (childPrivate->entity_device != NULL) {
+                       parentPrivate->entity_device = CFStringCreateCopy(NULL, childPrivate->entity_device);
+               }
+               if (parentPrivate->entity_subtype != NULL) {
+                       CFArrayRef      components;
+                       CFIndex         n;
+                       CFStringRef     vpnType;
+
+                       //
+                       // the "default" interface name is derived from the VPN type
+                       //
+                       // e.g.
+                       //      com.apple.Apple-VPN.vpnplugin --> "Apple VPN"
+                       //                ^^^^^^^^^
+                       //
+                       vpnType = parentPrivate->entity_subtype;
+                       components = CFStringCreateArrayBySeparatingStrings(NULL, vpnType, CFSTR("."));
+                       n = CFArrayGetCount(components);
+                       if ((n >= 4) &&
+                           CFEqual(CFArrayGetValueAtIndex(components, n - 1), CFSTR("vpnplugin"))) {
+                               CFMutableStringRef      str;
+
+                               str = CFStringCreateMutableCopy(NULL,
+                                                               0,
+                                                               CFArrayGetValueAtIndex(components, n - 2));
+                               (void) CFStringFindAndReplace(str,
+                                                             CFSTR("-"),
+                                                             CFSTR(" "),
+                                                             CFRangeMake(0, CFStringGetLength(str)),
+                                                             0);
+                               parentPrivate->localized_name = str;
+                       }
+                       CFRelease(components);
+               }
        } else if (CFStringFind(interfaceType, CFSTR("."), 0).location != kCFNotFound) {
                // if custom interface type
-               parentPrivate->interface_type = interfaceType;
-               parentPrivate->entity_type    = interfaceType;                  // interface config goes into a
+               if (vendor_interface_types == NULL) {
+                       vendor_interface_types = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+               }
+               CFSetAddValue(vendor_interface_types, interfaceType);
+
+               parentPrivate->interface_type = CFSetGetValue(vendor_interface_types, interfaceType);
+               parentPrivate->entity_type    = parentPrivate->interface_type;  // interface config goes into a
                                                                                // a dictionary with the same
                                                                                // name as the interfaceType
        } else {
@@ -3616,6 +3982,8 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
                goto fail;
        }
 
+       parentPrivate->hidden = childPrivate->hidden;
+
        if (childPrivate->overrides != NULL) {
                parentPrivate->overrides = CFDictionaryCreateMutableCopy(NULL, 0, childPrivate->overrides);
        }
@@ -3911,7 +4279,8 @@ copy_display_name(SCNetworkInterfaceRef interface, Boolean localized, Boolean ol
                SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
                if ((interfacePrivate->interface != NULL) &&
-                   (interfacePrivate->interface != kSCNetworkInterfaceIPv4)) {
+                   (interfacePrivate->interface != kSCNetworkInterfaceIPv4) &&
+                   !CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeVPN)) {
                        child = interfacePrivate->interface;
                }
 
@@ -3988,6 +4357,7 @@ copy_display_name(SCNetworkInterfaceRef interface, Boolean localized, Boolean ol
 }
 
 
+#if    !TARGET_OS_EMBEDDED && !TARGET_IPHONE_SIMULATOR
 __private_extern__
 CFStringRef
 __SCNetworkInterfaceCopyXLocalizedDisplayName(SCNetworkInterfaceRef interface)
@@ -4018,6 +4388,7 @@ __SCNetworkInterfaceCopyXNonLocalizedDisplayName(SCNetworkInterfaceRef interface
        localized_name = copy_display_name(interface, FALSE, TRUE);
        return localized_name;
 }
+#endif // !TARGET_OS_EMBEDDED && !TARGET_IPHONE_SIMULATOR
 
 
 __private_extern__
@@ -4059,13 +4430,13 @@ SCNetworkInterfaceGetLocalizedDisplayName(SCNetworkInterfaceRef interface)
 
 __private_extern__
 CFDictionaryRef
-__SCNetworkInterfaceGetTemplateOverrides(SCNetworkInterfaceRef interface, CFStringRef interfaceType)
+__SCNetworkInterfaceGetTemplateOverrides(SCNetworkInterfaceRef interface, CFStringRef overrideType)
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
        CFDictionaryRef                 overrides               = NULL;
 
        if (interfacePrivate->overrides != NULL) {
-               overrides = CFDictionaryGetValue(interfacePrivate->overrides, interfaceType);
+               overrides = CFDictionaryGetValue(interfacePrivate->overrides, overrideType);
        }
 
        return overrides;
@@ -4309,7 +4680,7 @@ __SCNetworkInterfaceForceConfigurationRefresh_helper(SCPreferencesRef prefs, CFS
        uint32_t                status          = kSCStatusOK;
        CFDataRef               reply           = NULL;
 
-       if (prefsPrivate->helper == -1) {
+       if (prefsPrivate->helper_port == MACH_PORT_NULL) {
                ok = __SCPreferencesCreate_helper(prefs);
                if (!ok) {
                        return FALSE;
@@ -4325,7 +4696,7 @@ __SCNetworkInterfaceForceConfigurationRefresh_helper(SCPreferencesRef prefs, CFS
        // have the helper "refresh" the configuration
        status = kSCStatusOK;
        reply  = NULL;
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           SCHELPER_MSG_INTERFACE_REFRESH,
                           data,
                           &status,
@@ -4344,9 +4715,8 @@ __SCNetworkInterfaceForceConfigurationRefresh_helper(SCPreferencesRef prefs, CFS
     fail :
 
        // close helper
-       if (prefsPrivate->helper != -1) {
-               _SCHelperClose(prefsPrivate->helper);
-               prefsPrivate->helper = -1;
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
        status = kSCStatusAccessError;
@@ -4554,6 +4924,18 @@ checkInterfacePassword(SCNetworkInterfaceRef             interface,
                        goto error;
                }
 
+               case kSCNetworkInterfacePasswordTypeVPN : {
+                       CFStringRef     interfaceType;
+
+                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVPN)) {
+                               // if VPN interface
+                               break;
+                       }
+
+                       goto error;
+               }
+
                default :
                        break;
        }
@@ -4671,6 +5053,27 @@ SCNetworkInterfaceCheckPassword(SCNetworkInterfaceRef            interface,
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeVPN : {
+                       CFDictionaryRef config;
+                       CFStringRef     vpn_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get serviceID
+                       vpn_id = getPasswordID(config, serviceID);
+
+                       // check
+                       exists = __extract_password(prefs,
+                                                   config,
+                                                   kSCPropNetVPNAuthPassword,
+                                                   kSCPropNetVPNAuthPasswordEncryption,
+                                                   kSCValNetVPNAuthPasswordEncryptionKeychain,
+                                                   vpn_id,
+                                                   NULL);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
@@ -4786,6 +5189,27 @@ SCNetworkInterfaceCopyPassword(SCNetworkInterfaceRef             interface,
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeVPN : {
+                       CFDictionaryRef config;
+                       CFStringRef     vpn_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get serviceID
+                       vpn_id = getPasswordID(config, serviceID);
+
+                       // extract
+                       (void) __extract_password(prefs,
+                                                 config,
+                                                 kSCPropNetVPNAuthPassword,
+                                                 kSCPropNetVPNAuthPasswordEncryption,
+                                                 kSCValNetVPNAuthPasswordEncryptionKeychain,
+                                                 vpn_id,
+                                                 &password);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return NULL;
@@ -4925,6 +5349,32 @@ SCNetworkInterfaceRemovePassword(SCNetworkInterfaceRef           interface,
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeVPN : {
+                       CFDictionaryRef config;
+                       CFDictionaryRef newConfig       = NULL;
+                       CFStringRef     vpn_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get serviceID
+                       vpn_id = getPasswordID(config, serviceID);
+
+                       // remove password
+                       ok = __remove_password(prefs,
+                                              config,
+                                              kSCPropNetVPNAuthPassword,
+                                              kSCPropNetVPNAuthPasswordEncryption,
+                                              kSCValNetVPNAuthPasswordEncryptionKeychain,
+                                              vpn_id,
+                                              &newConfig);
+                       if (ok) {
+                               ok = SCNetworkInterfaceSetConfiguration(interface, newConfig);
+                               if (newConfig != NULL) CFRelease(newConfig);
+                       }
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
@@ -5097,7 +5547,7 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef               interface,
                        // set password
                        ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
                                                                         shared_id,
-                                                                        (label != NULL)       ? label       : CFSTR("VPN Connection"),
+                                                                        (label != NULL)       ? label       : CFSTR("Network Connection"),
                                                                         (description != NULL) ? description : CFSTR("IPSec Shared Secret"),
                                                                         account,
                                                                         password,
@@ -5145,13 +5595,14 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef             interface,
                        // get 802.1X identifier
                        if (config != NULL) {
                                unique_id = CFDictionaryGetValue(config, kEAPClientPropUserPasswordKeychainItemID);
+                               unique_id = isA_CFString(unique_id);
                        }
-                       if (isA_CFString(unique_id)) {
+                       if (unique_id != NULL) {
                                CFRetain(unique_id);
                        } else {
                                CFUUIDRef       uuid;
 
-                               uuid     = CFUUIDCreate(NULL);
+                               uuid      = CFUUIDCreate(NULL);
                                unique_id = CFUUIDCreateString(NULL, uuid);
                                CFRelease(uuid);
                        }
@@ -5268,7 +5719,7 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef               interface,
                        // store password
                        ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
                                                                         xauth_id,
-                                                                        (label != NULL)       ? label       : CFSTR("VPN Connection"),
+                                                                        (label != NULL)       ? label       : CFSTR("Network Connection"),
                                                                         (description != NULL) ? description : CFSTR("IPSec XAuth Password"),
                                                                         account,
                                                                         password,
@@ -5300,6 +5751,81 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef              interface,
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeVPN : {
+                       SCNetworkServiceRef     service = NULL;
+                       CFStringRef             vpn_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get serviceID
+                       vpn_id = getPasswordID(config, serviceID);
+
+                       // get "Account", "Name", "Kind"
+                       if (config != NULL) {
+                               // auth name --> keychain "Account"
+                               account = CFDictionaryGetValue(config, kSCPropNetVPNAuthName);
+
+                               // VPN [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) {
+                               // "VPN Password" --> keychain "Kind"
+                               description = CFBundleCopyLocalizedString(bundle,
+                                                                         CFSTR("KEYCHAIN_KIND_VPN_PASSWORD"),
+                                                                         CFSTR("VPN Password"),
+                                                                         NULL);
+                       }
+
+                       // store password
+                       ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
+                                                                        vpn_id,
+                                                                        (label != NULL)       ? label       : CFSTR("Network Connection"),
+                                                                        (description != NULL) ? description : CFSTR("VPN 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,
+                                                    kSCPropNetVPNAuthPassword,
+                                                    vpn_id);
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetVPNAuthPasswordEncryption,
+                                                    kSCValNetVPNAuthPasswordEncryptionKeychain);
+                               ok = SCNetworkInterfaceSetConfiguration(interface, newConfig);
+                               CFRelease(newConfig);
+                       }
+
+                       if (description != NULL) CFRelease(description);
+                       if (service     != NULL) CFRelease(service);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        break;
@@ -5485,9 +6011,26 @@ _SCNetworkInterfaceCopySlashDevPath(SCNetworkInterfaceRef interface)
 
                overrides = IORegistryEntrySearchCFProperty(device,
                                                            kIOServicePlane,
-                                                           CFSTR("DeviceModemOverrides"),
+                                                           kSCNetworkInterfaceNetworkConfigurationOverridesKey,
                                                            NULL,
                                                            kIORegistryIterateRecursively | kIORegistryIterateParents);
+               if (overrides != NULL) {
+                       CFDictionaryRef modemOverrides;
+
+                       modemOverrides = CFDictionaryGetValue(overrides, kSCEntNetModem);
+                       if (modemOverrides != NULL) {
+                               CFRetain(modemOverrides);
+                       }
+                       CFRelease(overrides);
+                       overrides = modemOverrides;
+               }
+               if (overrides == NULL) {
+                       overrides = IORegistryEntrySearchCFProperty(device,
+                                                                   kIOServicePlane,
+                                                                   CFSTR("DeviceModemOverrides"),
+                                                                   NULL,
+                                                                   kIORegistryIterateRecursively | kIORegistryIterateParents);
+               }
                if (overrides != NULL) {
                        if (isA_CFDictionary(overrides)) {
                                CFStringRef     matchIdentifier;
@@ -5528,7 +6071,34 @@ _SCNetworkInterfaceIsBluetoothPAN(SCNetworkInterfaceRef interface)
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
-       return (interfacePrivate->sort_order == kSortBluetoothPAN);
+       return (interfacePrivate->sort_order == kSortBluetoothPAN_GN);
+}
+
+
+Boolean
+_SCNetworkInterfaceIsBluetoothPAN_NAP(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return (interfacePrivate->sort_order == kSortBluetoothPAN_NAP);
+}
+
+
+Boolean
+_SCNetworkInterfaceIsBluetoothP2P(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return (interfacePrivate->sort_order == kSortBluetoothPAN_U);
+}
+
+
+Boolean
+_SCNetworkInterfaceIsHiddenConfiguration(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return interfacePrivate->hidden;
 }
 
 
@@ -5616,6 +6186,7 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef             allocator,
        if (oldPrivate->configurationAction != NULL) {
                newPrivate->configurationAction = CFRetain(oldPrivate->configurationAction);
        }
+       newPrivate->hidden                      = oldPrivate->hidden;
        if (oldPrivate->location != NULL) {
                newPrivate->location            = CFRetain(oldPrivate->location);
        }
@@ -5642,7 +6213,7 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef             allocator,
                newPrivate->usb.pid             = CFRetain(oldPrivate->usb.pid);
        }
        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);
@@ -5653,6 +6224,15 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef            allocator,
        if (oldPrivate->bond.options != NULL) {
                newPrivate->bond.options        = CFRetain(oldPrivate->bond.options);
        }
+
+       newPrivate->supportsBridge              = oldPrivate->supportsBridge;
+       if (oldPrivate->bridge.interfaces != NULL) {
+               newPrivate->bridge.interfaces   = CFRetain(oldPrivate->bridge.interfaces);
+       }
+       if (oldPrivate->bridge.options != NULL) {
+               newPrivate->bridge.options      = CFRetain(oldPrivate->bridge.options);
+       }
+
        newPrivate->supportsVLAN                = oldPrivate->supportsVLAN;
        if (oldPrivate->vlan.interface != NULL) {
                newPrivate->vlan.interface      = CFRetain(oldPrivate->vlan.interface);
@@ -5663,7 +6243,6 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef             allocator,
        if (oldPrivate->vlan.options != NULL) {
                newPrivate->vlan.options        = CFRetain(oldPrivate->vlan.options);
        }
-#endif // !TARGET_OS_IPHONE
 
        return newPrivate;
 }
@@ -5732,6 +6311,51 @@ __SCNetworkInterfaceCopyDeepConfiguration(SCNetworkSetRef set, SCNetworkInterfac
 }
 
 
+__private_extern__ Boolean
+__SCNetworkInterfaceIsMember(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
+{
+       CFArrayRef      interfaces;
+       Boolean         match           = FALSE;
+       CFMutableSetRef members;
+
+       members = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+
+       // add Bond [member] interfaces
+       interfaces = SCBondInterfaceCopyAll(prefs);
+       if (interfaces != NULL) {
+               __SCBondInterfaceListCollectMembers(interfaces, members);
+               CFRelease(interfaces);
+       }
+
+       // add Bridge [member] interfaces
+       interfaces = SCBridgeInterfaceCopyAll(prefs);
+       if (interfaces != NULL) {
+               __SCBridgeInterfaceListCollectMembers(interfaces, members);
+               CFRelease(interfaces);
+       }
+
+       if (CFSetGetCount(members) == 0) {
+               goto done;
+       }
+
+       while (interface != NULL) {
+               match = CFSetContainsValue(members, interface);
+               if (match) {
+                       // if the interface is a member of an
+                       // Ethernet Bond or Bridge
+                       break;
+               }
+
+               interface = SCNetworkInterfaceGetInterface(interface);
+       }
+
+    done :
+
+       CFRelease(members);
+       return match;
+}
+
+
 __private_extern__
 void
 __SCNetworkInterfaceSetDeepConfiguration(SCNetworkSetRef set, SCNetworkInterfaceRef interface, CFArrayRef configs)
index 6a8818d9461dc323ebdf7afa20190c72f5113da8..7cc048c36831f9a8993f0646127690c563dbba6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -34,9 +34,7 @@
 #include <Availability.h>
 #include <TargetConditionals.h>
 #include <sys/cdefs.h>
-#if    !TARGET_OS_IPHONE
 #include <dispatch/dispatch.h>
-#endif // !TARGET_OS_IPHONE
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 
 #include <ppp/ppp_msg.h>
 
+#if    !TARGET_IPHONE_SIMULATOR
+#include <ppp/PPPControllerPriv.h>
+#endif // !TARGET_IPHONE_SIMULATOR
+
+
+
+#if    ((__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000)) && !TARGET_IPHONE_SIMULATOR
+#define        HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL
+#endif // ((__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000)) && !TARGET_IPHONE_SIMULATOR
+
+#if    ((__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000)) && !TARGET_IPHONE_SIMULATOR && !TARGET_OS_EMBEDDED_OTHER
+#define        HAVE_IPSEC_STATUS
+#define        HAVE_VPN_STATUS
+#endif // ((__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000)) && !TARGET_IPHONE_SIMULATOR && !TARGET_OS_EMBEDDED_OTHER
+
+
+#ifdef HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL
+/* Libinfo SPI */
+mach_port_t
+_getaddrinfo_interface_async_call(const char                   *nodename,
+                                 const char                    *servname,
+                                 const struct addrinfo         *hints,
+                                 const char                    *interface,
+                                 getaddrinfo_async_callback    callback,
+                                 void                          *context);
+#endif /* HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL */
 
 
 #define kSCNetworkReachabilityFlagsFirstResolvePending (1<<31)
 
 
-#define        N_QUICK 32
+#define        N_QUICK 64
 
 
 typedef enum {
@@ -96,12 +120,9 @@ 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,
@@ -111,7 +132,7 @@ __SCNetworkReachabilityUnscheduleFromRunLoop        (SCNetworkReachabilityRef       target,
 
 typedef struct {
        SCNetworkReachabilityFlags      flags;
-       uint16_t                        if_index;
+       unsigned int                    if_index;
        Boolean                         sleeping;
 } ReachabilityInfo;
 
@@ -135,6 +156,10 @@ typedef struct {
        CFArrayRef                      resolvedAddress;        /* CFArray[CFData] */
        int                             resolvedAddressError;
 
+       /* [scoped routing] interface constraints */
+       unsigned int                    if_index;
+       char                            if_name[IFNAMSIZ];
+
        /* local & remote addresses */
        struct sockaddr                 *localAddress;
        struct sockaddr                 *remoteAddress;
@@ -150,11 +175,9 @@ typedef struct {
        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;
@@ -193,8 +216,8 @@ 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 const ReachabilityInfo  NOT_REACHABLE   = { 0,          0,      FALSE };
+static const ReachabilityInfo  NOT_REPORTED    = { 0xFFFFFFFF, 0,      FALSE };
 static int                     rtm_seq         = 0;
 
 
@@ -212,12 +235,7 @@ static IOPMSystemPowerStateCapabilities    power_capabilities      = kIOPMSytemPowerStat
 
 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;
 
 
@@ -273,98 +291,256 @@ __log_query_time(SCNetworkReachabilityRef target, Boolean found, Boolean async,
 }
 
 
-static int
-updatePPPStatus(SCDynamicStoreRef              *storeP,
-               const struct sockaddr           *sa,
-               const char                      *if_name,
-               SCNetworkReachabilityFlags      *flags,
-               CFStringRef                     *ppp_server,
-               const char                      *log_prefix)
+static __inline__ Boolean
+__reach_equal(ReachabilityInfo *r1, ReachabilityInfo *r2)
 {
-       CFDictionaryRef         dict            = NULL;
+       if ((r1->flags    == r2->flags   ) &&
+           (r1->if_index == r2->if_index) &&
+           (r1->sleeping == r2->sleeping)) {
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+
+typedef struct {
+       SCDynamicStoreRef       store;
+       Boolean                 storeAdded;
        CFStringRef             entity;
-       CFIndex                 i;
-       const void *            keys_q[N_QUICK];
-       const void **           keys            = keys_q;
+       CFDictionaryRef         dict;
        CFIndex                 n;
-       CFStringRef             ppp_if;
-       int                     sc_status       = kSCStatusReachabilityUnknown;
-       SCDynamicStoreRef       store           = *storeP;
+       const void **           keys;
+       const void *            keys_q[N_QUICK];
+       const void **           values;
        const void *            values_q[N_QUICK];
-       const void **           values  = values_q;
+} ReachabilityStoreInfo, *ReachabilityStoreInfoRef;
 
-       switch (sa->sa_family) {
+
+static void
+initReachabilityStoreInfo(ReachabilityStoreInfoRef store_info)
+{
+       bzero(store_info, sizeof(ReachabilityStoreInfo));
+       return;
+}
+
+
+static Boolean
+updateReachabilityStoreInfo(ReachabilityStoreInfoRef   store_info,
+                           SCDynamicStoreRef           *storeP,
+                           sa_family_t                 sa_family)
+{
+       CFStringRef             pattern;
+       CFMutableArrayRef       patterns;
+
+       switch (sa_family) {
+               case AF_UNSPEC :
+                       store_info->entity = NULL;
+                       break;
                case AF_INET :
-                       entity = kSCEntNetIPv4;
+                       store_info->entity = kSCEntNetIPv4;
                        break;
                case AF_INET6 :
-                       entity = kSCEntNetIPv6;
+                       store_info->entity = kSCEntNetIPv6;
                        break;
                default :
-                       goto done;
+                       return FALSE;
        }
 
-       if (store == NULL) {
-               store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL);
-               if (store == NULL) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("updatePPPStatus SCDynamicStoreCreate() failed"));
-                       goto done;
+       if (store_info->dict != NULL) {
+               // if info already available
+               return TRUE;
+       }
+
+       if (store_info->store == NULL) {
+               store_info->store = (storeP != NULL) ? *storeP : NULL;
+               if (store_info->store == NULL) {
+                       store_info->store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL);
+                       if (store_info->store == NULL) {
+                               SCLog(TRUE, LOG_ERR, CFSTR("updateReachabilityStoreInfo SCDynamicStoreCreate() failed"));
+                               return FALSE;
+                       }
+
+                       if (storeP != NULL) {
+                               /// pass back the allocated SCDynamicStoreRef
+                               *storeP = store_info->store;
+                       } else {
+                               // this one is ours
+                               store_info->storeAdded = TRUE;
+                       }
                }
-               *storeP = store;
        }
 
-       // grab a snapshot of the PPP 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,
-                                                                     kSCEntNetPPP);
-               CFArrayAppendValue(patterns, pattern);
-               CFRelease(pattern);
-               pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                                     kSCDynamicStoreDomainState,
-                                                                     kSCCompAnyRegex,
-                                                                     kSCEntNetPPP);
-               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;
+       if (sa_family == AF_UNSPEC) {
+               // if the address family was not specified than
+               // all we wanted, for now, was to establish the
+               // SCDynamicStore session
+               return TRUE;
        }
 
-       sc_status = kSCStatusOK;
+       patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
-       // look for the service which matches the provided interface
-       n = CFDictionaryGetCount(dict);
-       if (n <= 0) {
-               goto done;
+       // get info for IPv4 services
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainSetup,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPv4);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPv4);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       // get info for IPv6 services
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainSetup,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPv6);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPv6);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       // get info for PPP services
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainSetup,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetPPP);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetPPP);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+#if    !TARGET_IPHONE_SIMULATOR
+       // get info for VPN services
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainSetup,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetVPN);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetVPN);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+#endif // !TARGET_IPHONE_SIMULATOR
+
+       // get info for IPSec services
+//     pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+//                                                           kSCDynamicStoreDomainSetup,
+//                                                           kSCCompAnyRegex,
+//                                                           kSCEntNetIPSec);
+//     CFArrayAppendValue(patterns, pattern);
+//     CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPSec);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       // get info to identify "available" services
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainSetup,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetInterface);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+
+       // get the SCDynamicStore info
+       store_info->dict = SCDynamicStoreCopyMultiple(store_info->store, NULL, patterns);
+       CFRelease(patterns);
+       if (store_info->dict == NULL) {
+               return FALSE;
+       }
+
+       // and extract the keys/values for post-processing
+       store_info->n = CFDictionaryGetCount(store_info->dict);
+       if (store_info->n > 0) {
+               if (store_info->n <= (CFIndex)(sizeof(store_info->keys_q) / sizeof(CFTypeRef))) {
+                       store_info->keys   = store_info->keys_q;
+                       store_info->values = store_info->values_q;
+               } else {
+                       store_info->keys   = CFAllocatorAllocate(NULL, store_info->n * sizeof(CFTypeRef), 0);
+                       store_info->values = CFAllocatorAllocate(NULL, store_info->n * sizeof(CFTypeRef), 0);
+               }
+               CFDictionaryGetKeysAndValues(store_info->dict,
+                                            store_info->keys,
+                                            store_info->values);
+       }
+
+       return TRUE;
+}
+
+
+static void
+freeReachabilityStoreInfo(ReachabilityStoreInfoRef store_info)
+{
+       if ((store_info->n > 0) && (store_info->keys != store_info->keys_q)) {
+               CFAllocatorDeallocate(NULL, store_info->keys);
+               store_info->keys = NULL;
+
+               CFAllocatorDeallocate(NULL, store_info->values);
+               store_info->values = NULL;
+       }
+
+       if (store_info->dict != NULL) {
+               CFRelease(store_info->dict);
+               store_info->dict = NULL;
+       }
+
+       if (store_info->storeAdded && (store_info->store != NULL)) {
+               CFRelease(store_info->store);
+               store_info->store = NULL;
+       }
+
+       return;
+}
+
+
+static int
+updatePPPStatus(ReachabilityStoreInfoRef       store_info,
+               const struct sockaddr           *sa,
+               const char                      *if_name,
+               SCNetworkReachabilityFlags      *flags,
+               CFStringRef                     *ppp_server,
+               const char                      *log_prefix)
+{
+       CFIndex         i;
+       CFStringRef     ppp_if;
+       int             sc_status       = kSCStatusNoKey;
+
+       if (!updateReachabilityStoreInfo(store_info, NULL, sa->sa_family)) {
+               return kSCStatusReachabilityUnknown;
+       }
+
+       if (store_info->n <= 0) {
+               // if no services
+               return kSCStatusNoKey;
        }
 
+       // look for the [PPP] service which matches the provided interface
+
        ppp_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++) {
+       for (i=0; i < store_info->n; i++) {
                CFArrayRef      components;
                CFStringRef     key;
                CFNumberRef     num;
@@ -373,16 +549,17 @@ updatePPPStatus(SCDynamicStoreRef         *storeP,
                int32_t         ppp_demand;
                int32_t         ppp_status;
                CFStringRef     service         = NULL;
-               CFStringRef     s_key           = (CFStringRef)    keys[i];
-               CFDictionaryRef s_dict          = (CFDictionaryRef)values[i];
+               CFStringRef     s_key           = (CFStringRef)    store_info->keys[i];
+               CFDictionaryRef s_dict          = (CFDictionaryRef)store_info->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
+               if (!CFStringHasSuffix(s_key, store_info->entity) ||
+                   !CFStringHasPrefix(s_key, kSCDynamicStoreDomainState)) {
+                       continue;       // if not an active IPv4 or IPv6 entity
                }
 
                s_if = CFDictionaryGetValue(s_dict, kSCPropInterfaceName);
@@ -407,13 +584,13 @@ updatePPPStatus(SCDynamicStoreRef         *storeP,
                                                                  kSCDynamicStoreDomainState,
                                                                  service,
                                                                  kSCEntNetPPP);
-               p_state = CFDictionaryGetValue(dict, key);
+               p_state = CFDictionaryGetValue(store_info->dict, key);
                CFRelease(key);
                key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                                  kSCDynamicStoreDomainSetup,
                                                                  service,
                                                                  kSCEntNetPPP);
-               p_setup = CFDictionaryGetValue(dict, key);
+               p_setup = CFDictionaryGetValue(store_info->dict, key);
                CFRelease(key);
                CFRelease(components);
 
@@ -422,6 +599,8 @@ updatePPPStatus(SCDynamicStoreRef           *storeP,
                        break;
                }
 
+               sc_status = kSCStatusOK;
+
                *flags |= kSCNetworkReachabilityFlagsTransientConnection;
 
                // get PPP server
@@ -449,6 +628,11 @@ updatePPPStatus(SCDynamicStoreRef          *storeP,
                                // if we're effectively UP and RUNNING
                                break;
                        case PPP_IDLE :
+                               // if we're not connected at all
+                               SCLog(_sc_debug, LOG_INFO, CFSTR("%s  PPP link idle"),
+                                     log_prefix);
+                               *flags |= kSCNetworkReachabilityFlagsConnectionRequired;
+                               break;
                        case PPP_STATERESERVED :
                                // if we're not connected at all
                                SCLog(_sc_debug, LOG_INFO, CFSTR("%s  PPP link idle, dial-on-traffic to connect"),
@@ -481,107 +665,35 @@ updatePPPStatus(SCDynamicStoreRef                *storeP,
        }
 
        CFRelease(ppp_if);
-       if (keys != keys_q) {
-               CFAllocatorDeallocate(NULL, keys);
-               CFAllocatorDeallocate(NULL, values);
-       }
 
-    done :
-
-       if (dict != NULL)       CFRelease(dict);
        return sc_status;
 }
 
 
 static int
-updatePPPAvailable(SCDynamicStoreRef           *storeP,
+updatePPPAvailable(ReachabilityStoreInfoRef    store_info,
                   const struct sockaddr        *sa,
                   SCNetworkReachabilityFlags   *flags,
                   const char                   *log_prefix)
 {
-       CFDictionaryRef         dict            = NULL;
-       CFStringRef             entity;
-       CFIndex                 i;
-       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;
-
-       if (sa == NULL) {
-               entity = kSCEntNetIPv4;
-       } else {
-               switch (sa->sa_family) {
-                       case AF_INET :
-                               entity = kSCEntNetIPv4;
-                               break;
-                       case AF_INET6 :
-                               entity = kSCEntNetIPv6;
-                               break;
-                       default :
-                               goto done;
-               }
-       }
+       CFIndex         i;
+       int             sc_status       = kSCStatusNoKey;
 
-       if (store == NULL) {
-               store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL);
-               if (store == NULL) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("updatePPPAvailable SCDynamicStoreCreate() failed"));
-                       goto done;
-               }
-               *storeP = store;
+       if (!updateReachabilityStoreInfo(store_info,
+                                        NULL,
+                                        (sa != NULL) ? sa->sa_family : AF_INET)) {
+               return kSCStatusReachabilityUnknown;
        }
 
-       // grab a snapshot of the PPP configuration from the dynamic store
-       {
-               CFStringRef             pattern;
-               CFMutableArrayRef       patterns;
-
-               patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-               pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                                     kSCDynamicStoreDomainSetup,
-                                                                     kSCCompAnyRegex,
-                                                                     entity);
-               CFArrayAppendValue(patterns, pattern);
-               CFRelease(pattern);
-               pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                                     kSCDynamicStoreDomainSetup,
-                                                                     kSCCompAnyRegex,
-                                                                     kSCEntNetInterface);
-               CFArrayAppendValue(patterns, pattern);
-               CFRelease(pattern);
-               pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                                     kSCDynamicStoreDomainSetup,
-                                                                     kSCCompAnyRegex,
-                                                                     kSCEntNetPPP);
-               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;
+       if (store_info->n <= 0) {
+               // if no services
+               return kSCStatusNoKey;
        }
 
-       sc_status = kSCStatusOK;
-
        // look for an available service which will provide connectivity
        // for the requested address family.
-       n = CFDictionaryGetCount(dict);
-       if (n <= 0) {
-               goto done;
-       }
-
-       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++) {
+       for (i = 0; i < store_info->n; i++) {
                CFArrayRef      components;
                Boolean         found           = FALSE;
                CFStringRef     i_key;
@@ -589,14 +701,15 @@ updatePPPAvailable(SCDynamicStoreRef              *storeP,
                CFStringRef     p_key;
                CFDictionaryRef p_dict;
                CFStringRef     service;
-               CFStringRef     s_key           = (CFStringRef)    keys[i];
-               CFDictionaryRef s_dict          = (CFDictionaryRef)values[i];
+               CFStringRef     s_key           = (CFStringRef)    store_info->keys[i];
+               CFDictionaryRef s_dict          = (CFDictionaryRef)store_info->values[i];
 
                if (!isA_CFString(s_key) || !isA_CFDictionary(s_dict)) {
                        continue;
                }
 
-               if (!CFStringHasSuffix(s_key, entity)) {
+               if (!CFStringHasSuffix(s_key, store_info->entity) ||
+                   !CFStringHasPrefix(s_key, kSCDynamicStoreDomainSetup)) {
                        continue;       // if not an IPv4 or IPv6 entity
                }
 
@@ -613,14 +726,14 @@ updatePPPAvailable(SCDynamicStoreRef              *storeP,
                                                                    kSCDynamicStoreDomainSetup,
                                                                    service,
                                                                    kSCEntNetPPP);
-               p_dict = CFDictionaryGetValue(dict, p_key);
+               p_dict = CFDictionaryGetValue(store_info->dict, p_key);
                CFRelease(p_key);
 
                i_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                                    kSCDynamicStoreDomainSetup,
                                                                    service,
                                                                    kSCEntNetInterface);
-               i_dict = CFDictionaryGetValue(dict, i_key);
+               i_dict = CFDictionaryGetValue(store_info->dict, i_key);
                CFRelease(i_key);
 
                if (isA_CFDictionary(p_dict) &&
@@ -660,120 +773,291 @@ updatePPPAvailable(SCDynamicStoreRef            *storeP,
                CFRelease(components);
 
                if (found) {
+                       sc_status = kSCStatusOK;
                        break;
                }
        }
 
-       if (keys != keys_q) {
-               CFAllocatorDeallocate(NULL, keys);
-               CFAllocatorDeallocate(NULL, values);
+       return sc_status;
+}
+
+
+#if    !TARGET_IPHONE_SIMULATOR
+static int
+updateVPNStatus(ReachabilityStoreInfoRef       store_info,
+               const struct sockaddr           *sa,
+               const char                      *if_name,
+               SCNetworkReachabilityFlags      *flags,
+               CFStringRef                     *vpn_server,
+               const char                      *log_prefix)
+{
+       CFIndex         i;
+       CFStringRef     vpn_if;
+       int             sc_status       = kSCStatusNoKey;
+
+       if (!updateReachabilityStoreInfo(store_info, NULL, sa->sa_family)) {
+               return kSCStatusReachabilityUnknown;
        }
 
-    done :
+       if (store_info->n <= 0) {
+               // if no services
+               return kSCStatusNoKey;
+       }
+
+       // look for the [VPN] service which matches the provided interface
+
+       vpn_if = CFStringCreateWithCStringNoCopy(NULL,
+                                                if_name,
+                                                kCFStringEncodingASCII,
+                                                kCFAllocatorNull);
+
+       for (i=0; i < store_info->n; i++) {
+               CFArrayRef      components;
+               CFStringRef     key;
+               CFNumberRef     num;
+               CFDictionaryRef p_state;
+               int32_t         vpn_status;
+               CFStringRef     service         = NULL;
+               CFStringRef     s_key           = (CFStringRef)    store_info->keys[i];
+               CFDictionaryRef s_dict          = (CFDictionaryRef)store_info->values[i];
+               CFStringRef     s_if;
+
+               if (!isA_CFString(s_key) || !isA_CFDictionary(s_dict)) {
+                       continue;
+               }
+
+               if (!CFStringHasSuffix(s_key, store_info->entity) ||
+                   !CFStringHasPrefix(s_key, kSCDynamicStoreDomainState)) {
+                       continue;       // if not an active IPv4 or IPv6 entity
+               }
+
+               s_if = CFDictionaryGetValue(s_dict, kSCPropInterfaceName);
+               if (!isA_CFString(s_if)) {
+                       continue;       // if no interface
+               }
+
+               if (!CFEqual(vpn_if, s_if)) {
+                       continue;       // if not this interface
+               }
+
+               // extract the service ID and get the VPN "state" entity for
+               // the "Status"
+               components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/"));
+               if (CFArrayGetCount(components) != 5) {
+                       CFRelease(components);
+                       break;
+               }
+               service = CFArrayGetValueAtIndex(components, 3);
+               key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                                 kSCDynamicStoreDomainState,
+                                                                 service,
+                                                                 kSCEntNetVPN);
+               p_state = CFDictionaryGetValue(store_info->dict, key);
+               CFRelease(key);
+               CFRelease(components);
+
+               // ensure that this is a VPN service
+               if (!isA_CFDictionary(p_state)) {
+                       break;
+               }
+
+               sc_status = kSCStatusOK;
+
+               *flags |= kSCNetworkReachabilityFlagsTransientConnection;
+
+               // get VPN server
+               if (vpn_server != NULL) {
+                       *vpn_server = CFDictionaryGetValue(s_dict, CFSTR("ServerAddress"));
+                       *vpn_server = isA_CFString(*vpn_server);
+                       if (*vpn_server != NULL) {
+                               CFRetain(*vpn_server);
+                       }
+               }
+
+               // get VPN status
+               if (!CFDictionaryGetValueIfPresent(p_state,
+                                                  kSCPropNetVPNStatus,
+                                                  (const void **)&num) ||
+                   !isA_CFNumber(num) ||
+                   !CFNumberGetValue(num, kCFNumberSInt32Type, &vpn_status)) {
+                       break;
+               }
+#ifdef HAVE_VPN_STATUS
+               switch (vpn_status) {
+                       case VPN_RUNNING :
+                               // if we're really UP and RUNNING
+                               break;
+                       case VPN_IDLE :
+                       case VPN_LOADING :
+                       case VPN_LOADED :
+                       case VPN_UNLOADING :
+                               // if we're not connected at all
+                               SCLog(_sc_debug, LOG_INFO, CFSTR("%s  VPN link idle"),
+                                     log_prefix);
+                               *flags |= kSCNetworkReachabilityFlagsConnectionRequired;
+                               break;
+                       default :
+                               // if we're in the process of [dis]connecting
+                               SCLog(_sc_debug, LOG_INFO, CFSTR("%s  VPN link, connection in progress"),
+                                     log_prefix);
+                               *flags |= kSCNetworkReachabilityFlagsConnectionRequired;
+                               break;
+               }
+#endif // HAVE_VPN_STATUS
+
+               break;
+       }
+
+       CFRelease(vpn_if);
 
-       if (dict != NULL)       CFRelease(dict);
        return sc_status;
 }
 
 
 static int
-updateIPSecStatus(SCDynamicStoreRef            *storeP,
-                 const struct sockaddr         *sa,
-                 const char                    *if_name,
-                 SCNetworkReachabilityFlags    *flags,
-                 CFStringRef                   *ipsec_server)
+updateVPNAvailable(ReachabilityStoreInfoRef    store_info,
+                  const struct sockaddr        *sa,
+                  SCNetworkReachabilityFlags   *flags,
+                  const char                   *log_prefix)
 {
-       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;
+       CFIndex         i;
+       int             sc_status       = kSCStatusNoKey;
 
-       switch (sa->sa_family) {
-               case AF_INET :
-                       entity = kSCEntNetIPv4;
-                       break;
-               case AF_INET6 :
-                       entity = kSCEntNetIPv6;
-                       break;
-               default :
-                       goto done;
+       if (!updateReachabilityStoreInfo(store_info,
+                                        NULL,
+                                        (sa != NULL) ? sa->sa_family : AF_INET)) {
+               return kSCStatusReachabilityUnknown;
        }
 
-       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;
+       if (store_info->n <= 0) {
+               // if no services
+               return kSCStatusNoKey;
        }
 
-       // 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;
+       // look for an available service which will provide connectivity
+       // for the requested address family.
+
+       for (i = 0; i < store_info->n; i++) {
+               CFArrayRef      components;
+               Boolean         found           = FALSE;
+               CFStringRef     i_key;
+               CFDictionaryRef i_dict;
+               CFStringRef     p_key;
+               CFDictionaryRef p_dict;
+               CFStringRef     service;
+               CFStringRef     s_key           = (CFStringRef)    store_info->keys[i];
+               CFDictionaryRef s_dict          = (CFDictionaryRef)store_info->values[i];
+
+               if (!isA_CFString(s_key) || !isA_CFDictionary(s_dict)) {
+                       continue;
+               }
+
+               if (!CFStringHasSuffix(s_key, store_info->entity) ||
+                   !CFStringHasPrefix(s_key, kSCDynamicStoreDomainSetup)) {
+                       continue;       // if not an IPv4 or IPv6 entity
+               }
+
+               // extract service ID
+               components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/"));
+               if (CFArrayGetCount(components) != 5) {
+                       CFRelease(components);
+                       continue;
+               }
+               service = CFArrayGetValueAtIndex(components, 3);
+
+               // check for VPN entity
+               p_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                                   kSCDynamicStoreDomainSetup,
+                                                                   service,
+                                                                   kSCEntNetVPN);
+               p_dict = CFDictionaryGetValue(store_info->dict, p_key);
+               CFRelease(p_key);
+
+               i_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                                   kSCDynamicStoreDomainSetup,
+                                                                   service,
+                                                                   kSCEntNetInterface);
+               i_dict = CFDictionaryGetValue(store_info->dict, i_key);
+               CFRelease(i_key);
+
+               if (isA_CFDictionary(p_dict) &&
+                   isA_CFDictionary(i_dict) &&
+                   CFDictionaryContainsKey(i_dict, kSCPropNetInterfaceDeviceName)) {
+                       // we have a VPN service for this address family
+                       found = TRUE;
+
+                       *flags |= kSCNetworkReachabilityFlagsReachable;
+                       *flags |= kSCNetworkReachabilityFlagsTransientConnection;
+                       *flags |= kSCNetworkReachabilityFlagsConnectionRequired;
+
+                       if (_sc_debug) {
+                               SCLog(TRUE, LOG_INFO, CFSTR("%s  status    = isReachable (after connect)"),
+                                     log_prefix);
+                               SCLog(TRUE, LOG_INFO, CFSTR("%s  service   = %@"),
+                                     log_prefix,
+                                     service);
+                       }
+
+               }
+
+               CFRelease(components);
+
+               if (found) {
+                       sc_status = kSCStatusOK;
+                       break;
+               }
        }
 
-       sc_status = kSCStatusOK;
+       return sc_status;
+}
+#endif // !TARGET_IPHONE_SIMULATOR
 
-       // look for the service which matches the provided interface
-       n = CFDictionaryGetCount(dict);
-       if (n <= 0) {
-               goto done;
+
+static int
+updateIPSecStatus(ReachabilityStoreInfoRef     store_info,
+                 const struct sockaddr         *sa,
+                 const char                    *if_name,
+                 SCNetworkReachabilityFlags    *flags,
+                 CFStringRef                   *ipsec_server,
+                 const char                    *log_prefix)
+{
+       CFIndex         i;
+       CFStringRef     ipsec_if;
+       int             sc_status       = kSCStatusNoKey;
+
+       if (!updateReachabilityStoreInfo(store_info, NULL, sa->sa_family)) {
+               return kSCStatusReachabilityUnknown;
+       }
+
+       if (store_info->n <= 0) {
+               // if no services
+               return kSCStatusNoKey;
        }
 
+       // look for the [IPSec] service that matches the provided interface
+
        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++) {
+       for (i=0; i < store_info->n; i++) {
                CFArrayRef      components;
                CFStringRef     key;
-               CFDictionaryRef i_setup;
+               CFDictionaryRef i_state;
+               int32_t         ipsec_status;
+               CFNumberRef     num;
                CFStringRef     service         = NULL;
-               CFStringRef     s_key           = (CFStringRef)    keys[i];
-               CFDictionaryRef s_dict          = (CFDictionaryRef)values[i];
+               CFStringRef     s_key           = (CFStringRef)    store_info->keys[i];
+               CFDictionaryRef s_dict          = (CFDictionaryRef)store_info->values[i];
                CFStringRef     s_if;
 
                if (!isA_CFString(s_key) || !isA_CFDictionary(s_dict)) {
                        continue;
                }
 
-               if (!CFStringHasSuffix(s_key, entity)) {
+               if (!CFStringHasSuffix(s_key, store_info->entity) ||
+                   !CFStringHasPrefix(s_key, kSCDynamicStoreDomainState)) {
                        continue;       // if not an IPv4 or IPv6 entity
                }
 
@@ -786,8 +1070,9 @@ updateIPSecStatus(SCDynamicStoreRef                *storeP,
                        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
+               // extract the service ID, get the IPSec "state" entity for
+               // the "Status", 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);
@@ -795,18 +1080,20 @@ updateIPSecStatus(SCDynamicStoreRef              *storeP,
                }
                service = CFArrayGetValueAtIndex(components, 3);
                key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                                 kSCDynamicStoreDomainSetup,
+                                                                 kSCDynamicStoreDomainState,
                                                                  service,
                                                                  kSCEntNetIPSec);
-               i_setup = CFDictionaryGetValue(dict, key);
+               i_state = CFDictionaryGetValue(store_info->dict, key);
                CFRelease(key);
                CFRelease(components);
 
                // ensure that this is an IPSec service
-               if (!isA_CFDictionary(i_setup)) {
+               if (!isA_CFDictionary(i_state)) {
                        break;
                }
 
+               sc_status = kSCStatusOK;
+
                *flags |= kSCNetworkReachabilityFlagsTransientConnection;
 
                // get IPSec server
@@ -818,18 +1105,39 @@ updateIPSecStatus(SCDynamicStoreRef              *storeP,
                        }
                }
 
+               // get IPSec status
+               if (!CFDictionaryGetValueIfPresent(i_state,
+                                                  kSCPropNetIPSecStatus,
+                                                  (const void **)&num) ||
+                   !isA_CFNumber(num) ||
+                   !CFNumberGetValue(num, kCFNumberSInt32Type, &ipsec_status)) {
+                       break;
+               }
+#ifdef HAVE_IPSEC_STATUS
+               switch (ipsec_status) {
+                       case IPSEC_RUNNING :
+                               // if we're really UP and RUNNING
+                               break;
+                       case IPSEC_IDLE :
+                               // if we're not connected at all
+                               SCLog(_sc_debug, LOG_INFO, CFSTR("%s  IPSec link idle"),
+                                     log_prefix);
+                               *flags |= kSCNetworkReachabilityFlagsConnectionRequired;
+                               break;
+                       default :
+                               // if we're in the process of [dis]connecting
+                               SCLog(_sc_debug, LOG_INFO, CFSTR("%s  IPSec link, connection in progress"),
+                                     log_prefix);
+                               *flags |= kSCNetworkReachabilityFlagsConnectionRequired;
+                               break;
+               }
+#endif // HAVE_IPSEC_STATUS
+
                break;
        }
 
        CFRelease(ipsec_if);
-       if (keys != keys_q) {
-               CFAllocatorDeallocate(NULL, keys);
-               CFAllocatorDeallocate(NULL, values);
-       }
 
-    done :
-
-       if (dict != NULL)       CFRelease(dict);
        return sc_status;
 }
 
@@ -878,9 +1186,11 @@ typedef struct {
  */
 static int
 route_get(const struct sockaddr        *address,
+         unsigned int          if_index,
          route_info            *info)
 {
        int                     n;
+       int                     opt;
        pid_t                   pid             = getpid();
        int                     rsock;
        struct sockaddr         *sa;
@@ -906,6 +1216,11 @@ route_get(const struct sockaddr   *address,
        info->rtm->rtm_pid     = pid;
        info->rtm->rtm_seq     = seq;
 
+       if (if_index != 0) {
+               info->rtm->rtm_flags |= RTF_IFSCOPE;
+               info->rtm->rtm_index = if_index;
+       }
+
        switch (address->sa_family) {
                case AF_INET6: {
                        struct sockaddr_in6     *sin6;
@@ -935,14 +1250,25 @@ route_get(const struct sockaddr  *address,
 #ifndef        RTM_GET_SILENT
        pthread_mutex_lock(&lock);
 #endif
-       rsock = socket(PF_ROUTE, SOCK_RAW, 0);
+       rsock = socket(PF_ROUTE, SOCK_RAW, PF_ROUTE);
        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(error));
+               SCLog(TRUE, LOG_ERR, CFSTR("socket(PF_ROUTE) failed: %s"), strerror(error));
+               return error;
+       }
+       opt = 1;
+       if (ioctl(rsock, FIONBIO, &opt) < 0) {
+               int     error   = errno;
+
+               (void)close(rsock);
+#ifndef        RTM_GET_SILENT
+               pthread_mutex_unlock(&lock);
+#endif
+               SCLog(TRUE, LOG_ERR, CFSTR("ioctl(FIONBIO) failed: %s"), strerror(error));
                return error;
        }
 
@@ -975,25 +1301,31 @@ route_get(const struct sockaddr  *address,
         * Type, seq, pid identify our response.
         * Routing sockets are broadcasters on input.
         */
-       do {
+       while (TRUE) {
                int     n;
 
                n = read(rsock, (void *)&info->buf, sizeof(info->buf));
                if (n == -1) {
-                       if (errno != EINTR) {
-                               int     error   = errno;
+                       int     error   = errno;
 
-                               (void)close(rsock);
+                       if (error == EINTR) {
+                               continue;
+                       }
+                       (void)close(rsock);
 #ifndef        RTM_GET_SILENT
-                               pthread_mutex_unlock(&lock);
+                       pthread_mutex_unlock(&lock);
 #endif
-                               SCLog(TRUE, LOG_ERR, CFSTR("read() failed: %s"), strerror(error));
-                               return error;
-                       }
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("SCNetworkReachability: routing socket"
+                                   " read() failed: %s"), strerror(error));
+                       return error;
                }
-       } while ((info->rtm->rtm_type != RTM_GET)       ||
-                (info->rtm->rtm_seq  != seq)           ||
-                (info->rtm->rtm_pid  != pid));
+               if ((info->rtm->rtm_type == RTM_GET)    &&
+                   (info->rtm->rtm_seq == seq)         &&
+                   (info->rtm->rtm_pid == pid)) {
+                   break;
+               }
+       }
 
        (void)close(rsock);
 #ifndef        RTM_GET_SILENT
@@ -1002,6 +1334,7 @@ route_get(const struct sockaddr   *address,
 
        get_rtaddrs(info->rtm->rtm_addrs, sa, info->rti_info);
 
+//#define LOG_RTADDRS
 #ifdef LOG_RTADDRS
        {
                int     i;
@@ -1041,14 +1374,15 @@ route_get(const struct sockaddr *address,
 
 
 static Boolean
-checkAddress(SCDynamicStoreRef         *storeP,
+checkAddress(ReachabilityStoreInfoRef  store_info,
             const struct sockaddr      *address,
+            unsigned int               if_index,
             ReachabilityInfo           *reach_info,
             const char                 *log_prefix)
 {
        route_info              info;
        struct ifreq            ifr;
-       char                    if_name[IFNAMSIZ + 1];
+       char                    if_name[IFNAMSIZ];
        int                     isock           = -1;
        int                     ret;
        int                     sc_status       = kSCStatusReachabilityUnknown;
@@ -1068,11 +1402,21 @@ checkAddress(SCDynamicStoreRef          *storeP,
                case AF_INET6 :
                        if (_sc_debug) {
                                char    addr[128];
+                               char    if_name[IFNAMSIZ + 1];
 
                                _SC_sockaddr_to_string(address, addr, sizeof(addr));
-                               SCLog(TRUE, LOG_INFO, CFSTR("%scheckAddress(%s)"),
+
+                               if ((if_index != 0) &&
+                                   (if_indextoname(if_index, &if_name[1]) != NULL)) {
+                                       if_name[0] = '%';
+                               } else {
+                                       if_name[0] = '\0';
+                               }
+
+                               SCLog(TRUE, LOG_INFO, CFSTR("%scheckAddress(%s%s)"),
                                      log_prefix,
-                                     addr);
+                                     addr,
+                                     if_name);
                        }
                        break;
                default :
@@ -1099,7 +1443,7 @@ checkAddress(SCDynamicStoreRef            *storeP,
                }
        }
 
-       ret = route_get(address, &info);
+       ret = route_get(address, if_index, &info);
        switch (ret) {
                case 0 :
                        break;
@@ -1221,13 +1565,23 @@ checkAddress(SCDynamicStoreRef          *storeP,
                 * 2. check for dial-on-demand PPP link that is not yet connected
                 * 3. get PPP server address
                 */
-               sc_status = updatePPPStatus(storeP, address, if_name, &reach_info->flags, &server, log_prefix);
+               sc_status = updatePPPStatus(store_info, address, if_name, &reach_info->flags, &server, log_prefix);
        } else if (info.sdl->sdl_type == IFT_OTHER) {
                /*
                 * 1. check if IPSec service
                 * 2. get IPSec server address
                 */
-               sc_status = updateIPSecStatus(storeP, address, if_name, &reach_info->flags, &server);
+               sc_status = updateIPSecStatus(store_info, address, if_name, &reach_info->flags, &server, log_prefix);
+
+#if    !TARGET_IPHONE_SIMULATOR
+               if (sc_status == kSCStatusNoKey) {
+                       /*
+                        * 1. check if VPN service
+                        * 2. get VPN server address
+                        */
+                       sc_status = updateVPNStatus(store_info, address, if_name, &reach_info->flags, &server, log_prefix);
+               }
+#endif // !TARGET_IPHONE_SIMULATOR
        }
 
 
@@ -1236,7 +1590,17 @@ checkAddress(SCDynamicStoreRef           *storeP,
     checkAvailable :
 
 
-       sc_status = updatePPPAvailable(storeP, address, &reach_info->flags, log_prefix);
+       sc_status = updatePPPAvailable(store_info, address, &reach_info->flags, log_prefix);
+       if ((sc_status == kSCStatusOK) && (reach_info->flags != 0)) {
+               goto done;
+       }
+
+#if    !TARGET_IPHONE_SIMULATOR
+       sc_status = updateVPNAvailable(store_info, address, &reach_info->flags, log_prefix);
+       if ((sc_status == kSCStatusOK) && (reach_info->flags != 0)) {
+               goto done;
+       }
+#endif // !TARGET_IPHONE_SIMULATOR
 
     done :
 
@@ -1246,7 +1610,7 @@ checkAddress(SCDynamicStoreRef            *storeP,
 
        if (isock != -1)        (void)close(isock);
        if (server != NULL)     CFRelease(server);
-       if (sc_status != kSCStatusOK) {
+       if ((sc_status != kSCStatusOK) && (sc_status != kSCStatusNoKey)) {
                _SCErrorSet(sc_status);
                return FALSE;
        }
@@ -1404,7 +1768,6 @@ __SCNetworkReachabilityPerform(SCNetworkReachabilityRef target)
 {
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
-#if    !TARGET_OS_IPHONE
        if (targetPrivate->dispatchQueue != NULL) {
                CFRetain(target);
                dispatch_async(targetPrivate->dispatchQueue,
@@ -1412,9 +1775,7 @@ __SCNetworkReachabilityPerform(SCNetworkReachabilityRef target)
                                       rlsPerform((void *)target);
                                       CFRelease(target);
                               });
-       } else
-#endif // !TARGET_OS_IPHONE
-       if (targetPrivate->rls != NULL) {
+       } else if (targetPrivate->rls != NULL) {
                CFRunLoopSourceSignal(targetPrivate->rls);
                _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList);
        }
@@ -1455,6 +1816,8 @@ __SCNetworkReachabilityCreatePrivate(CFAllocatorRef       allocator)
        targetPrivate->resolvedAddress                  = NULL;
        targetPrivate->resolvedAddressError             = NETDB_SUCCESS;
 
+       targetPrivate->if_index                         = 0;
+
        targetPrivate->localAddress                     = NULL;
        targetPrivate->remoteAddress                    = NULL;
 
@@ -1493,15 +1856,63 @@ __SCNetworkReachabilityCreatePrivate(CFAllocatorRef     allocator)
 }
 
 
+
+
+static const struct sockaddr *
+is_valid_address(const struct sockaddr *address)
+{
+       const struct sockaddr   *valid  = NULL;
+       static Boolean  warned  = FALSE;
+
+       if ((address != NULL) &&
+           (address->sa_len <= sizeof(struct sockaddr_storage))) {
+               switch (address->sa_family) {
+                       case AF_INET :
+                               if (address->sa_len >= sizeof(struct sockaddr_in)) {
+                                       valid = address;
+                               } else {
+                                       if (!warned) {
+                                               SCLog(TRUE, LOG_ERR,
+                                                     CFSTR("SCNetworkReachabilityCreateWithAddress[Pair] called with \"struct sockaddr *\" len %d < %d"),
+                                                     address->sa_len,
+                                                     sizeof(struct sockaddr_in));
+                                               warned = TRUE;
+                                       }
+                               }
+                               break;
+                       case AF_INET6 :
+                               if (address->sa_len >= sizeof(struct sockaddr_in6)) {
+                                       valid = address;
+                               } else if (!warned) {
+                                       SCLog(TRUE, LOG_ERR,
+                                             CFSTR("SCNetworkReachabilityCreateWithAddress[Pair] called with \"struct sockaddr *\" len %d < %d"),
+                                             address->sa_len,
+                                             sizeof(struct sockaddr_in6));
+                                       warned = TRUE;
+                               }
+                               break;
+                       default :
+                               if (!warned) {
+                                       SCLog(TRUE, LOG_ERR,
+                                             CFSTR("SCNetworkReachabilityCreateWithAddress[Pair] called with invalid address family %d"),
+                                             address->sa_family);
+                                       warned = TRUE;
+                               }
+               }
+       }
+
+       return valid;
+}
+
+
 SCNetworkReachabilityRef
 SCNetworkReachabilityCreateWithAddress(CFAllocatorRef          allocator,
                                       const struct sockaddr    *address)
 {
        SCNetworkReachabilityPrivateRef targetPrivate;
 
-       if ((address == NULL) ||
-           (address->sa_len == 0) ||
-           (address->sa_len > sizeof(struct sockaddr_storage))) {
+       address = is_valid_address(address);
+       if (address == NULL) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
@@ -1532,18 +1943,18 @@ SCNetworkReachabilityCreateWithAddressPair(CFAllocatorRef               allocator,
        }
 
        if (localAddress != NULL) {
-               if ((localAddress->sa_len == 0) ||
-                   (localAddress->sa_len > sizeof(struct sockaddr_storage))) {
-                           _SCErrorSet(kSCStatusInvalidArgument);
-                           return NULL;
+               localAddress = is_valid_address(localAddress);
+               if (localAddress == NULL) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
                }
        }
 
        if (remoteAddress != NULL) {
-               if ((remoteAddress->sa_len == 0) ||
-                   (remoteAddress->sa_len > sizeof(struct sockaddr_storage))) {
-                           _SCErrorSet(kSCStatusInvalidArgument);
-                           return NULL;
+               remoteAddress = is_valid_address(remoteAddress);
+               if (remoteAddress == NULL) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
                }
        }
 
@@ -1634,12 +2045,15 @@ SCNetworkReachabilityRef
 SCNetworkReachabilityCreateWithOptions(CFAllocatorRef  allocator,
                                       CFDictionaryRef  options)
 {
+       const struct sockaddr           *addr_l         = NULL;
+       const struct sockaddr           *addr_r         = NULL;
        CFBooleanRef                    bypass;
        CFDataRef                       data;
-       struct addrinfo                 *hints  = NULL;
-       const char                      *name;
+       struct addrinfo                 *hints          = NULL;
+       CFStringRef                     interface       = NULL;
        CFStringRef                     nodename;
        CFStringRef                     servname;
+       SCNetworkReachabilityRef        target;
        SCNetworkReachabilityPrivateRef targetPrivate;
 
        if (!isA_CFDictionary(options)) {
@@ -1659,6 +2073,22 @@ SCNetworkReachabilityCreateWithOptions(CFAllocatorRef    allocator,
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
+       data = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionLocalAddress);
+       if (data != NULL) {
+               if (!isA_CFData(data) || (CFDataGetLength(data) < sizeof(struct sockaddr_in))) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+               addr_l = (const struct sockaddr *)CFDataGetBytePtr(data);
+       }
+       data = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionRemoteAddress);
+       if (data != NULL) {
+               if (!isA_CFData(data) || (CFDataGetLength(data) < sizeof(struct sockaddr_in))) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+               addr_r = (const struct sockaddr *)CFDataGetBytePtr(data);
+       }
        data = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionHints);
        if (data != NULL) {
                if (!isA_CFData(data) || (CFDataGetLength(data) != sizeof(targetPrivate->hints))) {
@@ -1675,23 +2105,47 @@ SCNetworkReachabilityCreateWithOptions(CFAllocatorRef   allocator,
                        return NULL;
                }
        }
-       bypass = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionConnectionOnDemandByPass);
-       if ((bypass != NULL) && !isA_CFBoolean(bypass)) {
+       interface = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionInterface);
+       if ((interface != NULL) &&
+           (!isA_CFString(interface) || (CFStringGetLength(interface) == 0))) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
-       if ((nodename == NULL) && (servname == NULL)) {
+       bypass = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionConnectionOnDemandByPass);
+       if ((bypass != NULL) && !isA_CFBoolean(bypass)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
-       name = _SC_cfstring_to_cstring(nodename, NULL, 0, kCFStringEncodingUTF8);
-       targetPrivate = (SCNetworkReachabilityPrivateRef)SCNetworkReachabilityCreateWithName(allocator, name);
-       CFAllocatorDeallocate(NULL, (void *)name);
-       if (targetPrivate == NULL) {
+       if ((nodename != NULL) || (servname != NULL)) {
+               const char      *name;
+
+               if ((addr_l != NULL) || (addr_r != NULL)) {
+                       // can't have both a name/serv and an address
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+
+               name = _SC_cfstring_to_cstring(nodename, NULL, 0, kCFStringEncodingUTF8);
+               target = SCNetworkReachabilityCreateWithName(allocator, name);
+               CFAllocatorDeallocate(NULL, (void *)name);
+       } else {
+               if ((addr_l != NULL) && (addr_r != NULL)) {
+                       target = SCNetworkReachabilityCreateWithAddressPair(NULL, addr_l, addr_r);
+               } else if (addr_r != NULL) {
+                       target = SCNetworkReachabilityCreateWithAddress(NULL, addr_r);
+               } else if (addr_l != NULL) {
+                       target = SCNetworkReachabilityCreateWithAddress(NULL, addr_l);
+               } else {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+       }
+       if (target == NULL) {
                return NULL;
        }
 
+       targetPrivate = (SCNetworkReachabilityPrivateRef)target;
        if (targetPrivate->type == reachabilityTypeName) {
                if (servname != NULL) {
                        targetPrivate->serv = _SC_cfstring_to_cstring(servname, NULL, 0, kCFStringEncodingUTF8);
@@ -1701,6 +2155,18 @@ SCNetworkReachabilityCreateWithOptions(CFAllocatorRef    allocator,
                }
        }
 
+       if (interface != NULL) {
+               if ((_SC_cfstring_to_cstring(interface,
+                                            targetPrivate->if_name,
+                                            sizeof(targetPrivate->if_name),
+                                            kCFStringEncodingASCII) == NULL) ||
+                   ((targetPrivate->if_index = if_nametoindex(targetPrivate->if_name)) == 0)) {
+                       CFRelease(targetPrivate);
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+       }
+
        if (bypass != NULL) {
                targetPrivate->onDemandBypass = CFBooleanGetValue(bypass);
        }
@@ -1737,7 +2203,7 @@ SCNetworkReachabilityCopyResolvedAddress(SCNetworkReachabilityRef target,
                *error_num = targetPrivate->resolvedAddressError;
        }
 
-       if ((targetPrivate->resolvedAddress != NULL) || (targetPrivate->resolvedAddressError != NETDB_SUCCESS)) {
+       if (targetPrivate->resolvedAddress != NULL) {
                if (isA_CFArray(targetPrivate->resolvedAddress)) {
                        return CFRetain(targetPrivate->resolvedAddress);
                } else {
@@ -1877,7 +2343,6 @@ getaddrinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, voi
 }
 
 
-#if    !TARGET_OS_IPHONE
 static boolean_t
 SCNetworkReachabilityNotifyMIGCallback(mach_msg_header_t *message, mach_msg_header_t *reply)
 {
@@ -1888,27 +2353,24 @@ SCNetworkReachabilityNotifyMIGCallback(mach_msg_header_t *message, mach_msg_head
        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
-                                                 };
+       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
+       targetPrivate->dnsMP   = mp;
+       targetPrivate->dnsPort = _SC_CFMachPortCreateWithPort("SCNetworkReachability",
+                                                             mp,
+                                                             getaddrinfo_async_handleCFReply,
+                                                             &context);
        if (targetPrivate->dispatchQueue != NULL) {
                targetPrivate->asyncDNSQueue = dispatch_queue_create("com.apple.SCNetworkReachabilty.async_DNS_query", NULL);
                if (targetPrivate->asyncDNSQueue == NULL) {
@@ -1933,9 +2395,7 @@ enqueueAsyncDNSQuery(SCNetworkReachabilityRef target, mach_port_t mp)
                                            SCNetworkReachabilityNotifyMIGCallback);
                });
                dispatch_resume(targetPrivate->asyncDNSSource);
-       } else
-#endif // !TARGET_OS_IPHONE
-       if (targetPrivate->rls != NULL) {
+       } else if (targetPrivate->rls != NULL) {
                CFIndex i;
                CFIndex n;
 
@@ -1952,7 +2412,6 @@ enqueueAsyncDNSQuery(SCNetworkReachabilityRef target, mach_port_t mp)
 
        return TRUE;
 
-#if    !TARGET_OS_IPHONE
     fail :
 
        if (targetPrivate->asyncDNSSource != NULL) {
@@ -1972,7 +2431,6 @@ enqueueAsyncDNSQuery(SCNetworkReachabilityRef target, mach_port_t mp)
 
        _SCErrorSet(kSCStatusFailed);
        return FALSE;
-#endif // !TARGET_OS_IPHONE
 }
 
 
@@ -1981,7 +2439,6 @@ dequeueAsyncDNSQuery(SCNetworkReachabilityRef target)
 {
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
-#if    !TARGET_OS_IPHONE
        if (targetPrivate->asyncDNSSource != NULL) {
                dispatch_source_cancel(targetPrivate->asyncDNSSource);
                if (targetPrivate->asyncDNSQueue != dispatch_get_current_queue()) {
@@ -1999,7 +2456,6 @@ dequeueAsyncDNSQuery(SCNetworkReachabilityRef target)
                dispatch_release(targetPrivate->asyncDNSQueue);
                targetPrivate->asyncDNSQueue = NULL;
        }
-#endif // !TARGET_OS_IPHONE
 
        if (targetPrivate->dnsRLS != NULL) {
                CFRelease(targetPrivate->dnsRLS);
@@ -2054,7 +2510,7 @@ processAsyncDNSReply(mach_port_t mp, void *msg, SCNetworkReachabilityRef target)
 
 
 static Boolean
-check_resolver_reachability(SCDynamicStoreRef          *storeP,
+check_resolver_reachability(ReachabilityStoreInfoRef   store_info,
                            dns_resolver_t              *resolver,
                            SCNetworkReachabilityFlags  *flags,
                            Boolean                     *haveDNS,
@@ -2081,7 +2537,7 @@ check_resolver_reachability(SCDynamicStoreRef             *storeP,
                        continue;
                }
 
-               ok = checkAddress(storeP, address, &ns_info, log_prefix);
+               ok = checkAddress(store_info, address, resolver->if_index, &ns_info, log_prefix);
                if (!ok) {
                        /* not today */
                        goto done;
@@ -2100,16 +2556,27 @@ check_resolver_reachability(SCDynamicStoreRef           *storeP,
 
 
 static Boolean
-check_matching_resolvers(SCDynamicStoreRef             *storeP,
+check_matching_resolvers(ReachabilityStoreInfoRef      store_info,
                         dns_config_t                   *dns_config,
                         const char                     *fqdn,
+                        unsigned int                   if_index,
                         SCNetworkReachabilityFlags     *flags,
                         Boolean                        *haveDNS,
                         const char                     *log_prefix)
 {
        int             i;
-       Boolean         matched = FALSE;
-       const char      *name   = fqdn;
+       Boolean         matched         = FALSE;
+       const char      *name           = fqdn;
+       int32_t         n_resolvers;
+       dns_resolver_t  **resolvers;
+
+       if (if_index == 0) {
+               n_resolvers = dns_config->n_resolver;
+               resolvers   = dns_config->resolver;
+       } else {
+               n_resolvers = dns_config->n_scoped_resolver;
+               resolvers   = dns_config->scoped_resolver;
+       }
 
        while (!matched && (name != NULL)) {
                int     len;
@@ -2119,11 +2586,15 @@ check_matching_resolvers(SCDynamicStoreRef              *storeP,
                 * matches one of our resolver configurations.
                 */
                len = strlen(name);
-               for (i = 0; i < dns_config->n_resolver; i++) {
+               for (i = 0; i < n_resolvers; i++) {
                        char            *domain;
                        dns_resolver_t  *resolver;
 
-                       resolver = dns_config->resolver[i];
+                       resolver = resolvers[i];
+                       if ((if_index != 0) && (if_index != resolver->if_index)) {
+                               continue;
+                       }
+
                        domain   = resolver->domain;
                        if (domain != NULL && (len == strlen(domain))) {
                                if (strcasecmp(name, domain) == 0) {
@@ -2133,7 +2604,7 @@ check_matching_resolvers(SCDynamicStoreRef                *storeP,
                                         * if name matches domain
                                         */
                                        matched = TRUE;
-                                       ok = check_resolver_reachability(storeP, resolver, flags, haveDNS, log_prefix);
+                                       ok = check_resolver_reachability(store_info, resolver, flags, haveDNS, log_prefix);
                                        if (!ok) {
                                                /* not today */
                                                return FALSE;
@@ -2160,6 +2631,42 @@ check_matching_resolvers(SCDynamicStoreRef               *storeP,
 }
 
 
+static dns_resolver_t *
+get_default_resolver(dns_config_t *dns_config, unsigned int if_index)
+{
+       int             i;
+       int32_t         n_resolvers;
+       dns_resolver_t  *resolver       = NULL;
+       dns_resolver_t  **resolvers;
+
+       if (if_index == 0) {
+               n_resolvers = dns_config->n_resolver;
+               resolvers   = dns_config->resolver;
+       } else {
+               n_resolvers = dns_config->n_scoped_resolver;
+               resolvers   = dns_config->scoped_resolver;
+       }
+
+       for (i = 0; i < n_resolvers; i++) {
+               if ((if_index != 0) && (if_index != resolvers[i]->if_index)) {
+                       continue;
+               }
+
+               if (((if_index == 0) && (i == 0)) ||
+                   ((if_index != 0) && (resolver == NULL))) {
+                       // if this is the first (aka default) resolver
+                       resolver = resolvers[i];
+               } else if ((resolvers[i]->domain == NULL) &&
+                          (resolvers[i]->search_order < resolver->search_order)) {
+                       // if this is a default resolver with a lower search order
+                       resolver = resolvers[i];
+               }
+       }
+
+       return resolver;
+}
+
+
 static dns_configuration_t *
 dns_configuration_retain()
 {
@@ -2289,11 +2796,12 @@ dns_configuration_unwatch()
 
 
 static Boolean
-_SC_R_checkResolverReachability(SCDynamicStoreRef              *storeP,
+_SC_R_checkResolverReachability(ReachabilityStoreInfoRef       store_info,
                                SCNetworkReachabilityFlags      *flags,
                                Boolean                         *haveDNS,
                                const char                      *nodename,
                                const char                      *servname,
+                               unsigned int                    if_index,
                                const char                      *log_prefix)
 {
        dns_resolver_t          *default_resolver;
@@ -2303,6 +2811,7 @@ _SC_R_checkResolverReachability(SCDynamicStoreRef         *storeP,
        int                     i;
        Boolean                 isFQDN                  = FALSE;
        uint32_t                len;
+       int                     ndots                   = 1;
        Boolean                 ok                      = TRUE;
        Boolean                 useDefault              = FALSE;
 
@@ -2353,12 +2862,12 @@ _SC_R_checkResolverReachability(SCDynamicStoreRef               *storeP,
                }
        }
 
-       default_resolver = dns->config->resolver[0];
+       default_resolver = get_default_resolver(dns->config, if_index);
 
        /*
         * check if the provided name matches a supplemental domain
         */
-       found = check_matching_resolvers(storeP, dns->config, fqdn, flags, haveDNS, log_prefix);
+       found = check_matching_resolvers(store_info, dns->config, fqdn, if_index, flags, haveDNS, log_prefix);
 
        if (!found && !isFQDN) {
                /*
@@ -2368,7 +2877,6 @@ _SC_R_checkResolverReachability(SCDynamicStoreRef         *storeP,
                 */
                char    *cp;
                int     dots;
-               int     ndots   = 1;
 
 #define        NDOTS_OPT       "ndots="
 #define        NDOTS_OPT_LEN   (sizeof("ndots=") - 1)
@@ -2416,9 +2924,10 @@ _SC_R_checkResolverReachability(SCDynamicStoreRef                *storeP,
                                }
 
                                // try the provided name with the search domain appended
-                               found = check_matching_resolvers(storeP,
+                               found = check_matching_resolvers(store_info,
                                                                 dns->config,
                                                                 search_fqdn,
+                                                                if_index,
                                                                 flags,
                                                                 haveDNS,
                                                                 log_prefix);
@@ -2447,7 +2956,7 @@ _SC_R_checkResolverReachability(SCDynamicStoreRef         *storeP,
                        }
 
                        dp = default_resolver->domain;
-                       for (i = LOCALDOMAINPARTS; !found && (i <= domain_parts); i++) {
+                       for (i = LOCALDOMAINPARTS; !found && (i <= (domain_parts - ndots)); i++) {
                                int     ret;
                                char    *search_fqdn    = NULL;
 
@@ -2457,9 +2966,10 @@ _SC_R_checkResolverReachability(SCDynamicStoreRef                *storeP,
                                }
 
                                // try the provided name with the [default] domain appended
-                               found = check_matching_resolvers(storeP,
+                               found = check_matching_resolvers(store_info,
                                                                 dns->config,
                                                                 search_fqdn,
+                                                                if_index,
                                                                 flags,
                                                                 haveDNS,
                                                                 log_prefix);
@@ -2475,7 +2985,7 @@ _SC_R_checkResolverReachability(SCDynamicStoreRef         *storeP,
                /*
                 * check the reachability of the default resolver
                 */
-               ok = check_resolver_reachability(storeP, default_resolver, flags, haveDNS, log_prefix);
+               ok = check_resolver_reachability(store_info, default_resolver, flags, haveDNS, log_prefix);
        }
 
        if (fqdn != nodename)   free(fqdn);
@@ -2497,7 +3007,21 @@ _SC_checkResolverReachability(SCDynamicStoreRef                  *storeP,
                              const char                        *nodename,
                              const char                        *servname)
 {
-       return _SC_R_checkResolverReachability(storeP, flags, haveDNS, nodename, servname, "");
+       Boolean                 ok;
+       ReachabilityStoreInfo   store_info;
+
+       initReachabilityStoreInfo(&store_info);
+       ok = updateReachabilityStoreInfo(&store_info, storeP, AF_UNSPEC);
+       if (!ok) {
+               goto done;
+       }
+
+       ok = _SC_R_checkResolverReachability(&store_info, flags, haveDNS, nodename, servname, 0, "");
+
+    done :
+
+       freeReachabilityStoreInfo(&store_info);
+       return ok;
 }
 
 
@@ -2513,9 +3037,16 @@ _SC_checkResolverReachabilityByAddress(SCDynamicStoreRef         *storeP,
                                       Boolean                          *haveDNS,
                                       struct sockaddr                  *sa)
 {
-       int                             i;
-       Boolean                         ok              = FALSE;
-       char                            ptr_name[128];
+       int                     i;
+       Boolean                 ok;
+       char                    ptr_name[128];
+       ReachabilityStoreInfo   store_info;
+
+       initReachabilityStoreInfo(&store_info);
+       ok = updateReachabilityStoreInfo(&store_info, storeP, AF_UNSPEC);
+       if (!ok) {
+               goto done;
+       }
 
        /*
         * Ideally, we would have an API that given a local IP
@@ -2582,29 +3113,46 @@ _SC_checkResolverReachabilityByAddress(SCDynamicStoreRef                *storeP,
                        goto done;
        }
 
-       ok = _SC_R_checkResolverReachability(storeP, flags, haveDNS, ptr_name, NULL, "");
+       ok = _SC_R_checkResolverReachability(&store_info, flags, haveDNS, ptr_name, NULL, 0, "");
 
     done :
 
+       freeReachabilityStoreInfo(&store_info);
        return ok;
 }
 
 
 static Boolean
 startAsyncDNSQuery(SCNetworkReachabilityRef target) {
-       int                             error;
-       mach_port_t                     mp;
+       int                             error   = 0;
+       mach_port_t                     mp      = MACH_PORT_NULL;
        Boolean                         ok;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
        (void) gettimeofday(&targetPrivate->dnsQueryStart, NULL);
 
-       error = getaddrinfo_async_start(&mp,
-                                       targetPrivate->name,
-                                       targetPrivate->serv,
-                                       &targetPrivate->hints,
-                                       __SCNetworkReachabilityCallbackSetResolvedAddress,
-                                       (void *)target);
+#ifdef HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL
+       if (targetPrivate->if_index == 0) {
+#endif /* HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL */
+               error = getaddrinfo_async_start(&mp,
+                                               targetPrivate->name,
+                                               targetPrivate->serv,
+                                               &targetPrivate->hints,
+                                               __SCNetworkReachabilityCallbackSetResolvedAddress,
+                                               (void *)target);
+#ifdef HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL
+       } else {
+               mp = _getaddrinfo_interface_async_call(targetPrivate->name,
+                                                      targetPrivate->serv,
+                                                      &targetPrivate->hints,
+                                                      targetPrivate->if_name,
+                                                      __SCNetworkReachabilityCallbackSetResolvedAddress,
+                                                      (void *)target);
+               if (mp == MACH_PORT_NULL) {
+                       error = EAI_SYSTEM;
+               }
+       }
+#endif /* HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL */
        if (error != 0) {
                /* save the error associated with the attempt to resolve the name */
                __SCNetworkReachabilityCallbackSetResolvedAddress(error, NULL, (void *)target);
@@ -2676,7 +3224,7 @@ __SCNetworkReachabilityOnDemandCheckCallback(SCNetworkReachabilityRef     onDemandSe
 
 
 static Boolean
-__SCNetworkReachabilityOnDemandCheck(SCDynamicStoreRef         *storeP,
+__SCNetworkReachabilityOnDemandCheck(ReachabilityStoreInfoRef  store_info,
                                     SCNetworkReachabilityRef   target,
                                     Boolean                    onDemandRetry,
                                     SCNetworkReachabilityFlags *flags)
@@ -2686,6 +3234,7 @@ __SCNetworkReachabilityOnDemandCheck(SCDynamicStoreRef            *storeP,
        CFStringRef                     onDemandRemoteAddress   = NULL;
        CFStringRef                     onDemandServiceID       = NULL;
        SCNetworkConnectionStatus       onDemandStatus;
+       SCDynamicStoreRef               store;
        SCNetworkReachabilityPrivateRef targetPrivate           = (SCNetworkReachabilityPrivateRef)target;
 
 //     SCLog(_sc_debug, LOG_INFO,
@@ -2700,12 +3249,17 @@ __SCNetworkReachabilityOnDemandCheck(SCDynamicStoreRef          *storeP,
        /*
         * check if an OnDemand VPN configuration matches the name.
         */
-       ok = __SCNetworkConnectionCopyOnDemandInfoWithName(storeP,
+       store = store_info->store;
+       ok = __SCNetworkConnectionCopyOnDemandInfoWithName(&store,
                                                           targetPrivate->onDemandName,
                                                           onDemandRetry,
                                                           &onDemandServiceID,
                                                           &onDemandStatus,
                                                           &onDemandRemoteAddress);
+       if (store_info->store != store) {
+               store_info->store = store;
+               store_info->storeAdded = TRUE;
+       }
        if (!_SC_CFEqual(targetPrivate->onDemandRemoteAddress, onDemandRemoteAddress) ||
            !_SC_CFEqual(targetPrivate->onDemandServiceID, onDemandServiceID)) {
                if (targetPrivate->onDemandRemoteAddress != NULL) {
@@ -2714,13 +3268,10 @@ __SCNetworkReachabilityOnDemandCheck(SCDynamicStoreRef          *storeP,
                }
 
                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) {
+                       } else if (targetPrivate->rls != NULL) {
                                CFIndex i;
                                CFIndex n;
 
@@ -2770,12 +3321,9 @@ __SCNetworkReachabilityOnDemandCheck(SCDynamicStoreRef           *storeP,
                                                                         &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
-                                       {
+                                       } else {
                                                CFIndex i;
                                                CFIndex n;
 
@@ -2841,8 +3389,88 @@ __SCNetworkReachabilityOnDemandCheck(SCDynamicStoreRef           *storeP,
 #pragma mark Reachability Flags
 
 
+#ifdef HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL
+typedef struct {
+       int             status;
+       struct addrinfo *res;
+} reply_info;
+
+
+static void
+reply_callback(int32_t status, struct addrinfo *res, void *context)
+{
+       reply_info      *reply  = (reply_info *)context;
+
+       reply->status = status;
+       reply->res    = res;
+       return;
+}
+
+
+static int
+getaddrinfo_interface_sync(const char                  *nodename,
+                          const char                   *servname,
+                          const struct addrinfo        *hints,
+                          const char                   *interface,
+                          struct addrinfo              **res)
+{
+       mach_port_t     mp;
+       reply_info      reply   = { NETDB_SUCCESS, NULL };
+
+       mp = _getaddrinfo_interface_async_call(nodename,
+                                              servname,
+                                              hints,
+                                              interface,
+                                              reply_callback,
+                                              (void *)&reply);
+       if (mp == MACH_PORT_NULL) {
+               return EAI_SYSTEM;
+       }
+
+       while (TRUE) {
+               int             g_status;
+               union {
+                       u_int8_t                buf[8192];
+                       mach_msg_empty_rcv_t    msg;
+               }               m_reply;
+               kern_return_t   m_status;
+
+               m_status = mach_msg(&m_reply.msg.header,        /* msg */
+                                   MACH_RCV_MSG,               /* options */
+                                   0,                          /* send_size */
+                                   sizeof(m_reply),            /* rcv_size */
+                                   mp,                         /* rcv_name */
+                                   MACH_MSG_TIMEOUT_NONE,      /* timeout */
+                                   MACH_PORT_NULL);            /* notify */
+               if (m_status != KERN_SUCCESS) {
+                       return EAI_SYSTEM;
+               }
+
+               g_status = getaddrinfo_async_handle_reply((void *)m_reply.buf);
+               if (g_status != 0) {
+                       if (reply.res != NULL) {
+                               freeaddrinfo(reply.res);
+                               reply.res = NULL;
+                       }
+                       return EAI_SYSTEM;
+               }
+
+               if ((reply.res != NULL) || (reply.status != NETDB_SUCCESS)) {
+                       // if we have a reply or an error
+                       break;
+               }
+
+               // if the request is not complete and needs to be re-queued
+       }
+
+       *res = reply.res;
+       return reply.status;
+}
+#endif /* HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL */
+
+
 static Boolean
-__SCNetworkReachabilityGetFlags(SCDynamicStoreRef              *storeP,
+__SCNetworkReachabilityGetFlags(ReachabilityStoreInfoRef       store_info,
                                SCNetworkReachabilityRef        target,
                                ReachabilityInfo                *reach_info,
                                Boolean                         async)
@@ -2869,8 +3497,9 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                                /*
                                 * Check "local" address
                                 */
-                               ok = checkAddress(storeP,
+                               ok = checkAddress(store_info,
                                                  targetPrivate->localAddress,
+                                                 targetPrivate->if_index,
                                                  &my_info,
                                                  targetPrivate->log_prefix);
                                if (!ok) {
@@ -2895,8 +3524,9 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                                /*
                                 * Check "remote" address
                                 */
-                               ok = checkAddress(storeP,
+                               ok = checkAddress(store_info,
                                                  targetPrivate->remoteAddress,
+                                                 targetPrivate->if_index,
                                                  &my_info,
                                                  targetPrivate->log_prefix);
                                if (!ok) {
@@ -2933,7 +3563,7 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                                 * 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);
+                               onDemand = __SCNetworkReachabilityOnDemandCheck(store_info, target, FALSE, &my_info.flags);
                                if (onDemand) {
                                        /* if OnDemand connection is needed */
                                        goto done;
@@ -2941,11 +3571,12 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef               *storeP,
                        }
 
                        /* check the reachability of the DNS servers */
-                       ok = _SC_R_checkResolverReachability(storeP,
+                       ok = _SC_R_checkResolverReachability(store_info,
                                                             &ns_flags,
                                                             &targetPrivate->haveDNS,
                                                             targetPrivate->name,
                                                             targetPrivate->serv,
+                                                            targetPrivate->if_index,
                                                             targetPrivate->log_prefix);
                        if (!ok) {
                                /* if we could not get DNS server info */
@@ -2962,8 +3593,9 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                                SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS server(s) not available"),
                                      targetPrivate->log_prefix);
 
-                               ok = checkAddress(storeP,
+                               ok = checkAddress(store_info,
                                                  NULL,
+                                                 targetPrivate->if_index,
                                                  &my_info,
                                                  targetPrivate->log_prefix);
                                if (!ok) {
@@ -3043,10 +3675,22 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef               *storeP,
                                (void) gettimeofday(&dnsQueryStart, NULL);
                        }
 
-                       error = getaddrinfo(targetPrivate->name,
-                                           targetPrivate->serv,
-                                           &targetPrivate->hints,
-                                           &res);
+#ifdef HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL
+                       if (targetPrivate->if_index == 0) {
+#endif // HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL
+                               error = getaddrinfo(targetPrivate->name,
+                                                   targetPrivate->serv,
+                                                   &targetPrivate->hints,
+                                                   &res);
+#ifdef HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL
+                       } else {
+                               error = getaddrinfo_interface_sync(targetPrivate->name,
+                                                                  targetPrivate->serv,
+                                                                  &targetPrivate->hints,
+                                                                  targetPrivate->if_name,
+                                                                  &res);
+                       }
+#endif // HAVE_GETADDRINFO_INTERFACE_ASYNC_CALL
 
                        __log_query_time(target,
                                         ((error == 0) && (res != NULL)),       // if successful query
@@ -3076,8 +3720,9 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
 
                                        sa = (struct sockaddr *)CFDataGetBytePtr(CFArrayGetValueAtIndex(addresses, i));
 
-                                       ok = checkAddress(storeP,
+                                       ok = checkAddress(store_info,
                                                          sa,
+                                                         targetPrivate->if_index,
                                                          &ns_info,
                                                          targetPrivate->log_prefix);
                                        if (!ok) {
@@ -3109,7 +3754,7 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                                                 * our initial DNS query failed, check again to see if there
                                                 * there is an OnDemand configuration that we should be using.
                                                 */
-                                               onDemand = __SCNetworkReachabilityOnDemandCheck(storeP, target, TRUE, &my_info.flags);
+                                               onDemand = __SCNetworkReachabilityOnDemandCheck(store_info, target, TRUE, &my_info.flags);
                                                if (onDemand) {
                                                        /* if OnDemand connection is needed */
                                                        goto done;
@@ -3122,8 +3767,9 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                                                 * the availability of configured (but not active)
                                                 * services.
                                                 */
-                                               ok = checkAddress(storeP,
+                                               ok = checkAddress(store_info,
                                                                  NULL,
+                                                                 targetPrivate->if_index,
                                                                  &my_info,
                                                                  targetPrivate->log_prefix);
                                                if (!ok) {
@@ -3165,7 +3811,7 @@ SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef            target,
                              SCNetworkReachabilityFlags        *flags)
 {
        Boolean                         ok              = TRUE;
-       SCDynamicStoreRef               store           = NULL;
+       ReachabilityStoreInfo           store_info;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
        if (!isA_SCNetworkReachability(target)) {
@@ -3173,6 +3819,7 @@ SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef            target,
                return FALSE;
        }
 
+       initReachabilityStoreInfo(&store_info);
        pthread_mutex_lock(&targetPrivate->lock);
 
        if (targetPrivate->scheduled) {
@@ -3182,13 +3829,13 @@ SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef          target,
        }
 
 
-       ok = __SCNetworkReachabilityGetFlags(&store, target, &targetPrivate->info, FALSE);
+       ok = __SCNetworkReachabilityGetFlags(&store_info, target, &targetPrivate->info, FALSE);
        *flags = targetPrivate->info.flags & ~kSCNetworkReachabilityFlagsFirstResolvePending;
-       if (store != NULL) CFRelease(store);
 
     done :
 
        pthread_mutex_unlock(&targetPrivate->lock);
+       freeReachabilityStoreInfo(&store_info);
        return ok;
 }
 
@@ -3236,31 +3883,49 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef   store)
        CFArrayAppendValue(keys, key);
        CFRelease(key);
 
-       // Setup: per-service IPv4 info
+       // Setup: per-service Interface info
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainSetup,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetInterface);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       // per-service IPv4 info
        pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                              kSCDynamicStoreDomainSetup,
                                                              kSCCompAnyRegex,
                                                              kSCEntNetIPv4);
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPv4);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
 
-       // Setup: per-service Interface info
+       // per-service IPv6 info
        pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                              kSCDynamicStoreDomainSetup,
                                                              kSCCompAnyRegex,
-                                                             kSCEntNetInterface);
+                                                             kSCEntNetIPv6);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPv6);
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
 
-       // Setup: per-service PPP info (for kSCPropNetPPPDialOnDemand)
+       // per-service PPP info (for existence, kSCPropNetPPPDialOnDemand, kSCPropNetPPPStatus)
        pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                              kSCDynamicStoreDomainSetup,
                                                              kSCCompAnyRegex,
                                                              kSCEntNetPPP);
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
-
-       // State: per-service PPP info (for kSCPropNetPPPStatus)
        pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                              kSCDynamicStoreDomainState,
                                                              kSCCompAnyRegex,
@@ -3268,27 +3933,33 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef   store)
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
 
-       // Setup: per-service IPSec info
+#if    !TARGET_IPHONE_SIMULATOR
+       // per-service VPN info (for existence, kSCPropNetVPNStatus)
        pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                              kSCDynamicStoreDomainSetup,
                                                              kSCCompAnyRegex,
-                                                             kSCEntNetIPSec);
+                                                             kSCEntNetVPN);
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
-
-       // State: per-interface IPv4 info
-       pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                               kSCDynamicStoreDomainState,
-                                                               kSCCompAnyRegex,
-                                                               kSCEntNetIPv4);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetVPN);
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
+#endif // !TARGET_IPHONE_SIMULATOR
 
-       // State: per-interface IPv6 info
-       pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
-                                                               kSCDynamicStoreDomainState,
-                                                               kSCCompAnyRegex,
-                                                               kSCEntNetIPv6);
+       // per-service IPSec info (for existence, kSCPropNetIPSecStatus)
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainSetup,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPSec);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPSec);
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
 
@@ -3315,16 +3986,17 @@ __SCNetworkReachabilityHandleChanges(SCDynamicStoreRef  store,
                                     CFArrayRef         changedKeys,
                                     void               *info)
 {
-       Boolean         dnsConfigChanged        = FALSE;
-       CFIndex         i;
-       CFStringRef     key;
-       CFIndex         nChanges                = CFArrayGetCount(changedKeys);
-       CFIndex         nTargets;
+       Boolean                 dnsConfigChanged        = FALSE;
+       CFIndex                 i;
+       CFStringRef             key;
+       CFIndex                 nChanges                = CFArrayGetCount(changedKeys);
+       CFIndex                 nTargets;
 #if    !TARGET_OS_IPHONE
-       Boolean         powerStatusChanged      = FALSE;
+       Boolean                 powerStatusChanged      = FALSE;
 #endif // !TARGET_OS_IPHONE
-       const void *    targets_q[N_QUICK];
-       const void **   targets                 = targets_q;
+       ReachabilityStoreInfo   store_info;
+       const void *            targets_q[N_QUICK];
+       const void **           targets                 = targets_q;
 
        if (nChanges == 0) {
                /* if no changes */
@@ -3372,31 +4044,34 @@ __SCNetworkReachabilityHandleChanges(SCDynamicStoreRef  store,
                const char      *str;
 
 #if    !TARGET_OS_IPHONE
+               #define PWR     4
                if (powerStatusChanged) {
-                       changes |= 4;
+                       changes |= PWR;
                        nChanges -= 1;
                }
 #endif // !TARGET_OS_IPHONE
 
+               #define DNS     2
                if (dnsConfigChanged) {
-                       changes |= 2;
+                       changes |= DNS;
                        nChanges -= 1;
                }
 
+               #define NET     1
                if (nChanges > 0) {
-                       changes |= 1;
+                       changes |= NET;
                }
 
                switch (changes) {
-                       case 0  : str = "";                             break;
-                       case 1  : str = "network ";                     break;
-                       case 2  : str = "DNS ";                         break;
-                       case 3  : str = "network and DNS ";             break;
+                       case 0           : str = "";                            break;
+                       case NET         : str = "network ";                    break;
+                       case DNS         : str = "DNS ";                        break;
+                       case DNS|NET     : 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;
+                       case PWR         : str = "power ";                      break;
+                       case PWR|NET     : str = "network and power ";          break;
+                       case PWR|DNS     : str = "DNS and power ";              break;
+                       case PWR|DNS|NET : str = "network, DNS, and power ";    break;
 #endif // !TARGET_OS_IPHONE
                        default : str = "??? ";
                }
@@ -3404,6 +4079,8 @@ __SCNetworkReachabilityHandleChanges(SCDynamicStoreRef    store,
                SCLog(TRUE, LOG_INFO, CFSTR("process %sconfiguration change"), str);
        }
 
+       initReachabilityStoreInfo(&store_info);
+
        if (nTargets > (CFIndex)(sizeof(targets_q) / sizeof(CFTypeRef)))
                targets = CFAllocatorAllocate(NULL, nTargets * sizeof(CFTypeRef), 0);
        CFSetGetValues(hn_targets, targets);
@@ -3425,12 +4102,17 @@ __SCNetworkReachabilityHandleChanges(SCDynamicStoreRef  store,
                                Boolean                         ok;
 
                                /* check the reachability of the DNS servers */
-                               ok = _SC_R_checkResolverReachability(&store,
-                                                                    &ns_flags,
-                                                                    &targetPrivate->haveDNS,
-                                                                    targetPrivate->name,
-                                                                    targetPrivate->serv,
-                                                                    targetPrivate->log_prefix);
+                               ok = updateReachabilityStoreInfo(&store_info, &store, AF_UNSPEC);
+                               if (ok) {
+                                       ok = _SC_R_checkResolverReachability(&store_info,
+                                                                            &ns_flags,
+                                                                            &targetPrivate->haveDNS,
+                                                                            targetPrivate->name,
+                                                                            targetPrivate->serv,
+                                                                            targetPrivate->if_index,
+                                                                            targetPrivate->log_prefix);
+                               }
+
                                if (!ok) {
                                        /* if we could not get DNS server info */
                                        SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS server reachability unknown"),
@@ -3476,6 +4158,8 @@ __SCNetworkReachabilityHandleChanges(SCDynamicStoreRef    store,
        }
        if (targets != targets_q)       CFAllocatorDeallocate(NULL, targets);
 
+       freeReachabilityStoreInfo(&store_info);
+
     done :
 
        pthread_mutex_unlock(&hn_lock);
@@ -3522,7 +4206,7 @@ rlsPerform(void *info)
        Boolean                         ok;
        ReachabilityInfo                reach_info      = NOT_REACHABLE;
        SCNetworkReachabilityCallBack   rlsFunction;
-       SCDynamicStoreRef               store           = NULL;
+       ReachabilityStoreInfo           store_info;
        SCNetworkReachabilityRef        target          = (SCNetworkReachabilityRef)info;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
@@ -3539,8 +4223,9 @@ rlsPerform(void *info)
        }
 
        /* update reachability, notify if status changed */
-       ok = __SCNetworkReachabilityGetFlags(&store, target, &reach_info, TRUE);
-       if (store != NULL) CFRelease(store);
+       initReachabilityStoreInfo(&store_info);
+       ok = __SCNetworkReachabilityGetFlags(&store_info, target, &reach_info, TRUE);
+       freeReachabilityStoreInfo(&store_info);
        if (!ok) {
                /* if reachability status not available */
                SCLog(_sc_debug, LOG_INFO, CFSTR("%flags not available"),
@@ -3564,14 +4249,14 @@ rlsPerform(void *info)
                         * the same or "better"
                         */
                        defer = TRUE;
-               } else if (bcmp(&targetPrivate->last_notify, &reach_info, sizeof(reach_info)) == 0) {
+               } else if (__reach_equal(&targetPrivate->last_notify, &reach_info)) {
                        /* if we have already posted this change */
                        defer = TRUE;
                }
        }
 #endif // !TARGET_OS_IPHONE
 
-       if (bcmp(&targetPrivate->info, &reach_info, sizeof(reach_info)) == 0) {
+       if (__reach_equal(&targetPrivate->info, &reach_info)) {
                SCLog(_sc_debug, LOG_INFO,
                      CFSTR("%sflags/interface match (now 0x%08x/%hu%s)"),
                      targetPrivate->log_prefix,
@@ -3618,7 +4303,9 @@ rlsPerform(void *info)
        pthread_mutex_unlock(&targetPrivate->lock);
 
        if (rlsFunction != NULL) {
-               (*rlsFunction)(target, reach_info.flags, context_info);
+               (*rlsFunction)(target,
+                              reach_info.flags & ~kSCNetworkReachabilityFlagsFirstResolvePending,
+                              context_info);
        }
 
        if (context_release != NULL) {
@@ -3677,11 +4364,7 @@ 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;
@@ -3693,13 +4376,11 @@ __SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef     target,
        }
        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);
                goto done;
        }
-#endif // !TARGET_OS_IPHONE
 
        /* schedule the SCNetworkReachability run loop source */
 
@@ -3724,7 +4405,6 @@ __SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef       target,
 
                __SCNetworkReachabilityReachabilitySetNotifications(hn_store);
 
-#if    !TARGET_OS_IPHONE
                hn_dispatchQueue = dispatch_queue_create("com.apple.SCNetworkReachabilty.network_changes", NULL);
                if (hn_dispatchQueue == NULL) {
                        SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkReachabilityScheduleWithRunLoop dispatch_queue_create() failed"));
@@ -3746,10 +4426,6 @@ __SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef      target,
                        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);
        }
 
@@ -3778,13 +4454,10 @@ __SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef     target,
                init = TRUE;
        }
 
-#if    !TARGET_OS_IPHONE
        if (queue != NULL) {
                targetPrivate->dispatchQueue = queue;
                dispatch_retain(targetPrivate->dispatchQueue);
-       } else
-#endif // !TARGET_OS_IPHONE
-       {
+       } else {
                if (!_SC_isScheduled(NULL, runLoop, runLoopMode, targetPrivate->rlList)) {
                        /*
                         * if we do not already have host notifications scheduled with
@@ -3799,35 +4472,20 @@ __SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef     target,
                }
 
                _SC_schedule(target, runLoop, runLoopMode, targetPrivate->rlList);
-
-#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);
-                       }
-
-                       _SC_schedule(target, runLoop, runLoopMode, hn_rlList);
-               }
-#endif // TARGET_OS_IPHONE
        }
 
        CFSetAddValue(hn_targets, target);
 
        if (init) {
                ReachabilityInfo        reach_info      = NOT_REACHABLE;
-               SCDynamicStoreRef       store           = NULL;
+               ReachabilityStoreInfo   store_info;
 
                /*
                 * if we have yet to schedule SC notifications for this address
                 * - initialize current reachability status
                 */
-               if (__SCNetworkReachabilityGetFlags(&store, target, &reach_info, TRUE)) {
+               initReachabilityStoreInfo(&store_info);
+               if (__SCNetworkReachabilityGetFlags(&store_info, target, &reach_info, TRUE)) {
                        /*
                         * if reachability status available
                         * - set flags
@@ -3839,7 +4497,7 @@ __SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef       target,
                        /* if reachability status not available, async lookup started */
                        targetPrivate->info = NOT_REACHABLE;
                }
-               if (store != NULL) CFRelease(store);
+               freeReachabilityStoreInfo(&store_info);
        }
 
        if (targetPrivate->onDemandServer != NULL) {
@@ -3873,13 +4531,11 @@ __SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef   target,
        }
        pthread_mutex_lock(&targetPrivate->lock);
 
-#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 (!targetPrivate->scheduled) {
                // if not currently scheduled
@@ -3888,14 +4544,11 @@ __SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef   target,
        }
 
        // 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
-       {
+       } else {
                if (!_SC_unschedule(target, runLoop, runLoopMode, targetPrivate->rlList, FALSE)) {
                        // if not currently scheduled
                        _SCErrorSet(kSCStatusInvalidArgument);
@@ -3944,77 +4597,17 @@ __SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef   target,
                }
        }
 
-#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)) {
-                       /*
-                        * if we no longer have any addresses scheduled for
-                        * this runLoop / runLoopMode
-                        */
-                       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);
@@ -4065,7 +4658,6 @@ SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef       target,
        return __SCNetworkReachabilityUnscheduleFromRunLoop(target, runLoop, runLoopMode, FALSE);
 }
 
-#if    !TARGET_OS_IPHONE
 Boolean
 SCNetworkReachabilitySetDispatchQueue(SCNetworkReachabilityRef target,
                                      dispatch_queue_t          queue)
@@ -4085,4 +4677,3 @@ SCNetworkReachabilitySetDispatchQueue(SCNetworkReachabilityRef    target,
 
        return ok;
 }
-#endif // !TARGET_OS_IPHONE
index 7d00c230239f1ff75c77996f94ba1efce8b12256..14c56c74a834c32f985d33fa0930b3d1dae1af7e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2005, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2005, 2008-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -31,9 +31,7 @@
 #include <sys/socket.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCNetwork.h>
-#if    !TARGET_OS_IPHONE
 #include <dispatch/dispatch.h>
-#endif // !TARGET_OS_IPHONE
 
 /*!
        @header SCNetworkReachability
@@ -152,9 +150,7 @@ enum {
        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
+       kSCNetworkReachabilityFlagsConnectionOnDemand   = 1<<5, // __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0)
        kSCNetworkReachabilityFlagsIsLocalAddress       = 1<<16,
        kSCNetworkReachabilityFlagsIsDirect             = 1<<17,
 #if    TARGET_OS_IPHONE
@@ -323,7 +319,6 @@ SCNetworkReachabilityUnscheduleFromRunLoop  (
                                                CFStringRef                     runLoopMode
                                                )                               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
 
-#if    !TARGET_OS_IPHONE
 /*!
        @function SCNetworkReachabilitySetDispatchQueue
        @discussion Schedules callbacks for the given target on the given
@@ -338,8 +333,7 @@ Boolean
 SCNetworkReachabilitySetDispatchQueue          (
                                                SCNetworkReachabilityRef        target,
                                                dispatch_queue_t                queue
-                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
-#endif // !TARGET_OS_IPHONE
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0);
 
 __END_DECLS
 
index d01acc0f707cdb5fd771eb3244723e7cb018bb15..efdc4b71cefa76209448f04c990ef34e122ac5a3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -172,6 +172,42 @@ __SCNetworkServiceCreatePrivate(CFAllocatorRef             allocator,
 }
 
 
+#pragma mark -
+#pragma mark Service ordering
+
+
+CFComparisonResult
+_SCNetworkServiceCompare(const void *val1, const void *val2, void *context)
+{
+       CFStringRef             id1;
+       CFStringRef             id2;
+       CFArrayRef              order   = (CFArrayRef)context;
+       SCNetworkServiceRef     s1      = (SCNetworkServiceRef)val1;
+       SCNetworkServiceRef     s2      = (SCNetworkServiceRef)val2;
+
+       id1 = SCNetworkServiceGetServiceID(s1);
+       id2 = SCNetworkServiceGetServiceID(s2);
+
+       if (order != NULL) {
+               CFIndex o1;
+               CFIndex o2;
+               CFRange range;
+
+               range = CFRangeMake(0, CFArrayGetCount(order));
+               o1 = CFArrayGetFirstIndexOfValue(order, range, id1);
+               o2 = CFArrayGetFirstIndexOfValue(order, range, id2);
+
+               if (o1 > o2) {
+                       return (o2 != kCFNotFound) ? kCFCompareGreaterThan : kCFCompareLessThan;
+               } else if (o1 < o2) {
+                       return (o1 != kCFNotFound) ? kCFCompareLessThan    : kCFCompareGreaterThan;
+               }
+       }
+
+       return CFStringCompare(id1, id2, 0);
+}
+
+
 #pragma mark -
 #pragma mark SCNetworkService APIs
 
@@ -179,36 +215,196 @@ __SCNetworkServiceCreatePrivate(CFAllocatorRef           allocator,
 #define        N_QUICK 64
 
 
+__private_extern__ CFArrayRef /* of SCNetworkServiceRef's */
+__SCNetworkServiceCopyAllEnabled(SCPreferencesRef prefs)
+{
+       CFMutableArrayRef       array   = NULL;
+       CFIndex                 i_sets;
+       CFIndex                 n_sets;
+       CFArrayRef              sets;
+
+       sets = SCNetworkSetCopyAll(prefs);
+       if (sets == NULL) {
+               return NULL;
+       }
+
+       n_sets = CFArrayGetCount(sets);
+       for (i_sets = 0; i_sets < n_sets; i_sets++) {
+               CFIndex         i_services;
+               CFIndex         n_services;
+               CFArrayRef      services;
+               SCNetworkSetRef set;
+
+               set = CFArrayGetValueAtIndex(sets, i_sets);
+               services = SCNetworkSetCopyServices(set);
+               if (services == NULL) {
+                       continue;
+               }
+
+               n_services = CFArrayGetCount(services);
+               for (i_services = 0; i_services < n_services; i_services++) {
+                       SCNetworkServiceRef service;
+
+                       service = CFArrayGetValueAtIndex(services, i_services);
+                       if (!SCNetworkServiceGetEnabled(service)) {
+                               // if not enabled
+                               continue;
+                       }
+
+                       if ((array == NULL) ||
+                           !CFArrayContainsValue(array,
+                                                 CFRangeMake(0, CFArrayGetCount(array)),
+                                                 service)) {
+                               if (array == NULL) {
+                                       array = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+                               }
+                               CFArrayAppendValue(array, service);
+                       }
+               }
+               CFRelease(services);
+       }
+       CFRelease(sets);
+
+       return array;
+}
+
+
+__private_extern__ Boolean
+__SCNetworkServiceExistsForInterface(CFArrayRef services, SCNetworkInterfaceRef interface)
+{
+       CFIndex i;
+       CFIndex n;
+
+       n = isA_CFArray(services) ? CFArrayGetCount(services) : 0;
+       for (i = 0; i < n; i++) {
+               SCNetworkServiceRef     service;
+               SCNetworkInterfaceRef   service_interface;
+
+               service = CFArrayGetValueAtIndex(services, i);
+
+               service_interface = SCNetworkServiceGetInterface(service);
+               while (service_interface != NULL) {
+                       if (CFEqual(interface, service_interface)) {
+                               return TRUE;
+                       }
+
+                       service_interface = SCNetworkInterfaceGetInterface(service_interface);
+               }
+       }
+
+       return FALSE;
+}
+
+
+__private_extern__ CFStringRef
+__SCNetworkServiceNextName(SCNetworkServiceRef service)
+{
+       CFArrayRef              components;
+       CFIndex                 n;
+       CFStringRef             name;
+       CFMutableArrayRef       newComponents;
+       SInt32                  suffix  = 2;
+
+       name = SCNetworkServiceGetName(service);
+       if (name == NULL) {
+               return NULL;
+       }
+
+       components = CFStringCreateArrayBySeparatingStrings(NULL, name, CFSTR(" "));
+       if (components != NULL) {
+               newComponents = CFArrayCreateMutableCopy(NULL, 0, components);
+               CFRelease(components);
+       } else {
+               newComponents = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               CFArrayAppendValue(newComponents, name);
+       }
+
+       n = CFArrayGetCount(newComponents);
+       if (n > 1) {
+               CFStringRef     str;
+
+               str = CFArrayGetValueAtIndex(newComponents, n - 1);
+               suffix = CFStringGetIntValue(str);
+               if (suffix++ > 0) {
+                       CFArrayRemoveValueAtIndex(newComponents, n - 1);
+               } else {
+                       suffix = 2;
+               }
+       }
+
+       name = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), suffix);
+       CFArrayAppendValue(newComponents, name);
+       CFRelease(name);
+
+       name = CFStringCreateByCombiningStrings(NULL, newComponents, CFSTR(" "));
+       CFRelease(newComponents);
+
+       return name;
+}
+
+
+static void
+mergeDict(const void *key, const void *value, void *context)
+{
+       CFMutableDictionaryRef  newDict = (CFMutableDictionaryRef)context;
+
+       CFDictionarySetValue(newDict, key, value);
+       return;
+}
+
+
 static CFDictionaryRef
 _protocolTemplate(SCNetworkServiceRef service, CFStringRef protocolType)
 {
-       CFDictionaryRef                 newEntity       = NULL;
+       SCNetworkInterfaceRef           interface;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
+       CFDictionaryRef                 template        = NULL;
 
-       if (servicePrivate->interface != NULL) {
+       interface = servicePrivate->interface;
+       if (interface != NULL) {
                SCNetworkInterfaceRef   childInterface;
                CFStringRef             childInterfaceType      = NULL;
                CFStringRef             interfaceType;
 
+               // get the template
                interfaceType = SCNetworkInterfaceGetInterfaceType(servicePrivate->interface);
                childInterface = SCNetworkInterfaceGetInterface(servicePrivate->interface);
                if (childInterface != NULL) {
                        childInterfaceType = SCNetworkInterfaceGetInterfaceType(childInterface);
                }
 
-               newEntity = __copyProtocolTemplate(interfaceType, childInterfaceType, protocolType);
+               template = __copyProtocolTemplate(interfaceType, childInterfaceType, protocolType);
+               if (template != NULL) {
+                       CFDictionaryRef         overrides;
+
+                       // move to the interface at the lowest layer
+                       while (childInterface != NULL) {
+                               interface = childInterface;
+                               childInterface = SCNetworkInterfaceGetInterface(interface);
+                       }
+
+                       overrides = __SCNetworkInterfaceGetTemplateOverrides(interface, protocolType);
+                       if (overrides != NULL) {
+                               CFMutableDictionaryRef  newTemplate;
+
+                               newTemplate = CFDictionaryCreateMutableCopy(NULL, 0, template);
+                               CFDictionaryApplyFunction(overrides, mergeDict, newTemplate);
+                               CFRelease(template);
+                               template = newTemplate;
+                       }
+               }
        }
 
-       if (newEntity == NULL) {
-               newEntity = CFDictionaryCreate(NULL,
-                                              NULL,
-                                              NULL,
-                                              0,
-                                              &kCFTypeDictionaryKeyCallBacks,
-                                              &kCFTypeDictionaryValueCallBacks);
+       if (template == NULL) {
+               template = CFDictionaryCreate(NULL,
+                                             NULL,
+                                             NULL,
+                                             0,
+                                             &kCFTypeDictionaryKeyCallBacks,
+                                             &kCFTypeDictionaryValueCallBacks);
        }
 
-       return newEntity;
+       return template;
 }
 
 
@@ -580,16 +776,6 @@ __SCNetworkServiceSetInterfaceEntity(SCNetworkServiceRef     service,
 }
 
 
-static void
-mergeDict(const void *key, const void *value, void *context)
-{
-       CFMutableDictionaryRef  newDict = (CFMutableDictionaryRef)context;
-
-       CFDictionarySetValue(newDict, key, value);
-       return;
-}
-
-
 SCNetworkServiceRef
 SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
 {
@@ -617,10 +803,18 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
 
                interface_type = SCNetworkInterfaceGetInterfaceType(interface);
                if (CFStringFind(interface_type, CFSTR("."), 0).location == kCFNotFound) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
                        return NULL;
                }
        }
 
+       // do not allow creation of a network service if the interface is a
+       // member of a bond or bridge
+       if (__SCNetworkInterfaceIsMember(prefs, interface)) {
+               _SCErrorSet(kSCStatusKeyExists);
+               return NULL;
+       }
+
        // establish the service
        prefix = SCPreferencesPathKeyCreateNetworkServices(NULL);
        path = __SCPreferencesPathCreateUniqueChild_WithMoreSCFCompatibility(prefs, prefix);
@@ -666,34 +860,28 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
                            CFEqual(interfaceType, kSCNetworkInterfaceTypeModem    ) ||
                            CFEqual(interfaceType, kSCNetworkInterfaceTypeSerial   ) ||
                            CFEqual(interfaceType, kSCNetworkInterfaceTypeWWAN     )) {
-                               CFDictionaryRef overrides;
+                               CFDictionaryRef         overrides;
 
                                overrides = __SCNetworkInterfaceGetTemplateOverrides(interface, kSCNetworkInterfaceTypeModem);
 
                                // a ConnectionScript (and related keys) from the interface
                                // should trump the settings from the configuration template.
-                               if ((overrides != NULL) &&
-                                   CFDictionaryContainsKey(overrides, kSCPropNetModemConnectionScript)) {
-                                       CFMutableDictionaryRef  newConfig;
-
-                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetModemConnectionPersonality);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetModemConnectionScript);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetModemDeviceVendor);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetModemDeviceModel);
-                                       CFRelease(config);
-                                       config = newConfig;
-                               }
-
                                if (overrides != NULL) {
                                        CFMutableDictionaryRef  newConfig;
 
                                        newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                                       if (CFDictionaryContainsKey(overrides, kSCPropNetModemConnectionScript)) {
+                                               CFDictionaryRemoveValue(newConfig, kSCPropNetModemConnectionPersonality);
+                                               CFDictionaryRemoveValue(newConfig, kSCPropNetModemConnectionScript);
+                                               CFDictionaryRemoveValue(newConfig, kSCPropNetModemDeviceVendor);
+                                               CFDictionaryRemoveValue(newConfig, kSCPropNetModemDeviceModel);
+                                       }
                                        CFDictionaryApplyFunction(overrides, mergeDict, newConfig);
                                        CFRelease(config);
                                        config = newConfig;
                                }
-                       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP) ||
+                                  CFEqual(interfaceType, kSCNetworkInterfaceTypeVPN)) {
                                CFDictionaryRef         overrides;
 
                                overrides = __SCNetworkInterfaceGetTemplateOverrides(interface, kSCNetworkInterfaceTypePPP);
@@ -896,9 +1084,16 @@ SCNetworkServiceGetName(SCNetworkServiceRef service)
        interface = SCNetworkServiceGetInterface(service);
        while (interface != NULL) {
                SCNetworkInterfaceRef   childInterface;
+               CFStringRef             interfaceType;
+
+               interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+               if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVPN)) {
+                       break;
+               }
 
                childInterface = SCNetworkInterfaceGetInterface(interface);
-               if ((childInterface == NULL) || CFEqual(childInterface, kSCNetworkInterfaceIPv4)) {
+               if ((childInterface == NULL) ||
+                   CFEqual(childInterface, kSCNetworkInterfaceIPv4)) {
                        break;
                }
 
@@ -935,6 +1130,7 @@ SCNetworkServiceGetName(SCNetworkServiceRef service)
                                                CFRetain(interface_name);
                                        }
                                        break;
+#if    !TARGET_OS_EMBEDDED && !TARGET_IPHONE_SIMULATOR
                                case 1 :
                                        // compare the older "Built-in XXX" localized name
                                        interface_name = __SCNetworkInterfaceCopyXLocalizedDisplayName(interface);
@@ -943,11 +1139,14 @@ SCNetworkServiceGetName(SCNetworkServiceRef service)
                                        // compare the older "Built-in XXX" non-localized name
                                        interface_name = __SCNetworkInterfaceCopyXNonLocalizedDisplayName(interface);
                                        break;
+#endif // !TARGET_OS_EMBEDDED && !TARGET_IPHONE_SIMULATOR
+                               default :
+                                       continue;
                        }
 
                        if (interface_name != NULL) {
                                Boolean match   = FALSE;
-                               
+
                                if (CFEqual(name, interface_name)) {
                                        // if service name matches the OLD localized
                                        // interface name
@@ -1113,6 +1312,19 @@ SCNetworkServiceSetEnabled(SCNetworkServiceRef service, Boolean enabled)
                return FALSE;
        }
 
+       // make sure that we do not enable a network service if the
+       // associated interface is a member of a bond or bridge.
+       if (enabled) {
+               SCNetworkInterfaceRef   interface;
+
+               interface = SCNetworkServiceGetInterface(service);
+               if ((interface != NULL) &&
+                   __SCNetworkInterfaceIsMember(servicePrivate->prefs, interface)) {
+                       _SCErrorSet(kSCStatusKeyExists);
+                       return FALSE;
+               }
+       }
+
        path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,                             // allocator
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
@@ -1508,3 +1720,39 @@ SCNetworkServiceSetPrimaryRank(SCNetworkServiceRef               service,
        if (path != NULL)       CFRelease(path);
        return ok;
 }
+
+
+Boolean
+_SCNetworkServiceIsVPN(SCNetworkServiceRef service)
+{
+       SCNetworkInterfaceRef   interface;
+       CFStringRef             interfaceType;
+
+       interface = SCNetworkServiceGetInterface(service);
+       if (interface == NULL) {
+               return FALSE;
+       }
+
+       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+       if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+               interface = SCNetworkInterfaceGetInterface(interface);
+               if (interface == NULL) {
+                       return FALSE;
+               }
+
+               interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+               if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) {
+                       return TRUE;
+               }
+               if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP)) {
+                       return TRUE;
+               }
+       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVPN)) {
+               return TRUE;
+       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) {
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
index 7ff57505d30fc699975a0b690c715afe8110f67e..dad99e74b61f44279cfed2a1b14f0283657ada72 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2007, 2009-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -169,48 +169,13 @@ __SCNetworkSetCreatePrivate(CFAllocatorRef      allocator,
 #pragma mark -
 
 
-static Boolean
-_serviceIsVPN(SCNetworkServiceRef service)
-{
-       SCNetworkInterfaceRef   interface;
-       CFStringRef             interfaceType;
-
-       interface = SCNetworkServiceGetInterface(service);
-       if (interface == NULL) {
-               return FALSE;
-       }
-
-       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
-       if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
-               interface = SCNetworkInterfaceGetInterface(interface);
-               if (interface == NULL) {
-                       return FALSE;
-               }
-
-               interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
-               if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) {
-                       return TRUE;
-               }
-               if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP)) {
-                       return TRUE;
-               }
-               return FALSE;
-       }
-       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) {
-               return TRUE;
-       }
-
-       return FALSE;
-}
-
-
 static int
 _serviceOrder(SCNetworkServiceRef service)
 {
        SCNetworkInterfaceRef   interface;
 
        interface = SCNetworkServiceGetInterface(service);
-       if ((interface == NULL) || _serviceIsVPN(service)) {
+       if ((interface == NULL) || _SCNetworkServiceIsVPN(service)) {
                return 100000;  // if unknown or VPN interface, sort last
        }
 
@@ -346,6 +311,15 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service)
                return FALSE;
        }
 
+       // make sure that we do not add an orphaned network service if its
+       // associated interface is a member of a bond or bridge.
+       interface = SCNetworkServiceGetInterface(service);
+       if ((interface != NULL) &&
+           __SCNetworkInterfaceIsMember(servicePrivate->prefs, interface)) {
+               _SCErrorSet(kSCStatusKeyExists);
+               return FALSE;
+       }
+
 #define PREVENT_DUPLICATE_SERVICE_NAMES
 #ifdef  PREVENT_DUPLICATE_SERVICE_NAMES
        CFStringRef     name;
@@ -376,9 +350,9 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service)
                                        return FALSE;
                                }
                        }
-               }
 
-               CFRelease(services);
+                       CFRelease(services);
+               }
        }
 #endif // PREVENT_DUPLICATE_SERVICE_NAMES
 
@@ -484,33 +458,6 @@ SCNetworkSetCopy(SCPreferencesRef prefs, CFStringRef setID)
 }
 
 
-static Boolean
-_SCNetworkServiceExistsForInterface(CFArrayRef services, SCNetworkInterfaceRef interface)
-{
-       CFIndex i;
-       CFIndex n;
-
-       n = isA_CFArray(services) ? CFArrayGetCount(services) : 0;
-       for (i = 0; i < n; i++) {
-               SCNetworkServiceRef     service;
-               SCNetworkInterfaceRef   service_interface;
-
-               service = CFArrayGetValueAtIndex(services, i);
-
-               service_interface = SCNetworkServiceGetInterface(service);
-               while (service_interface != NULL) {
-                       if (CFEqual(interface, service_interface)) {
-                               return TRUE;
-                       }
-
-                       service_interface = SCNetworkInterfaceGetInterface(service_interface);
-               }
-       }
-
-       return FALSE;
-}
-
-
 Boolean
 SCNetworkSetContainsInterface(SCNetworkSetRef set, SCNetworkInterfaceRef interface)
 {
@@ -519,7 +466,7 @@ SCNetworkSetContainsInterface(SCNetworkSetRef set, SCNetworkInterfaceRef interfa
 
        services = SCNetworkSetCopyServices(set);
        if (services != NULL) {
-               found = _SCNetworkServiceExistsForInterface(services, interface);
+               found = __SCNetworkServiceExistsForInterface(services, interface);
                CFRelease(services);
        }
 
@@ -709,6 +656,8 @@ SCNetworkSetRef
 SCNetworkSetCreate(SCPreferencesRef prefs)
 {
        CFArrayRef              components;
+       CFDictionaryRef         entity;
+       Boolean                 ok;
        CFStringRef             path;
        CFStringRef             prefix;
        CFStringRef             setID;
@@ -723,8 +672,6 @@ SCNetworkSetCreate(SCPreferencesRef prefs)
        }
 
        components = CFStringCreateArrayBySeparatingStrings(NULL, path, CFSTR("/"));
-       CFRelease(path);
-
        setID = CFArrayGetValueAtIndex(components, 2);
        setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, setID);
        CFRelease(components);
@@ -732,6 +679,19 @@ SCNetworkSetCreate(SCPreferencesRef prefs)
        // mark set as "new" (not yet established)
        setPrivate->established = FALSE;
 
+       // establish the set in the preferences
+       entity = CFDictionaryCreate(NULL,
+                                   NULL, NULL, 0,
+                                   &kCFTypeDictionaryKeyCallBacks,
+                                   &kCFTypeDictionaryValueCallBacks);
+       ok = SCPreferencesPathSetValue(prefs, path, entity);
+       CFRelease(path);
+       CFRelease(entity);
+       if (!ok) {
+               CFRelease(setPrivate);
+               setPrivate = NULL;
+       }
+
        return (SCNetworkSetRef)setPrivate;
 }
 
@@ -869,6 +829,8 @@ SCNetworkSetRemove(SCNetworkSetRef set)
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
        if (!isA_CFString(currentPath) || !CFEqual(currentPath, path)) {
                ok = SCPreferencesPathRemoveValue(setPrivate->prefs, path);
+       } else {
+               _SCErrorSet(kSCStatusInvalidArgument);
        }
        CFRelease(path);
 
@@ -1168,64 +1130,67 @@ add_supported_interfaces(CFMutableArrayRef interface_list, SCNetworkInterfaceRef
        return;
 }
 
-
-static CFStringRef
-next_service_name(SCNetworkServiceRef service)
+static CFSetRef        /* of SCNetworkInterfaceRef's */
+copyExcludedInterfaces(SCPreferencesRef prefs)
 {
-       CFArrayRef              components;
-       CFIndex                 n;
-       CFStringRef             name;
-       CFMutableArrayRef       newComponents;
-       SInt32                  suffix  = 2;
+       CFMutableSetRef excluded;
+       CFArrayRef      interfaces;
 
-       name = SCNetworkServiceGetName(service);
-       if (name == NULL) {
-               return NULL;
-       }
+       excluded = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
 
-       components = CFStringCreateArrayBySeparatingStrings(NULL, name, CFSTR(" "));
-       if (components != NULL) {
-               newComponents = CFArrayCreateMutableCopy(NULL, 0, components);
-               CFRelease(components);
-       } else {
-               newComponents = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-               CFArrayAppendValue(newComponents, name);
+       // exclude Bond [member] interfaces
+       interfaces = SCBondInterfaceCopyAll(prefs);
+       if (interfaces != NULL) {
+               __SCBondInterfaceListCollectMembers(interfaces, excluded);
+               CFRelease(interfaces);
        }
 
-       n = CFArrayGetCount(newComponents);
-       if (n > 1) {
-               CFStringRef     str;
-
-               str = CFArrayGetValueAtIndex(newComponents, n - 1);
-               suffix = CFStringGetIntValue(str);
-               if (suffix++ > 0) {
-                       CFArrayRemoveValueAtIndex(newComponents, n - 1);
-               } else {
-                       suffix = 2;
-               }
+       // exclude Bridge [member] interfaces
+       interfaces = SCBridgeInterfaceCopyAll(prefs);
+       if (interfaces != NULL) {
+               __SCBridgeInterfaceListCollectMembers(interfaces, excluded);
+               CFRelease(interfaces);
        }
 
-       name = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), suffix);
-       CFArrayAppendValue(newComponents, name);
-       CFRelease(name);
-
-       name = CFStringCreateByCombiningStrings(NULL, newComponents, CFSTR(" "));
-       CFRelease(newComponents);
-
-       return name;
+       return excluded;
 }
 
 
 static Boolean
 __SCNetworkSetEstablishDefaultConfigurationForInterfaces(SCNetworkSetRef set, CFArrayRef interfaces)
 {
+       CFSetRef                excluded        = NULL;
        CFIndex                 i;
-       CFIndex                 n;
+       CFIndex                 n               = 0;
        Boolean                 ok              = TRUE;
        CFArrayRef              services;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
        Boolean                 updated         = FALSE;
 
+#if    TARGET_OS_IPHONE
+       CFArrayRef              orphans         = NULL;
+       CFArrayRef              sets;
+
+       sets = SCNetworkSetCopyAll(setPrivate->prefs);
+       if (sets != NULL) {
+               if (CFArrayGetCount(sets) == 1) {
+                       services = SCNetworkSetCopyServices(set);
+                       if (services != NULL) {
+                               n = CFArrayGetCount(services);
+                               CFRelease(services);
+                       }
+
+                       if ((n == 0) && CFEqual(set, CFArrayGetValueAtIndex(sets, 0))) {
+                               // after a "Reset Network Settings" we need to find (and
+                               // add back) any VPN services that were orphaned.
+                               orphans = SCNetworkServiceCopyAll(setPrivate->prefs);
+                       }
+               }
+
+               CFRelease(sets);
+       }
+#endif // TARGET_OS_IPHONE
+
        // first, assume that we only want to add new services
        // for those interfaces that are not represented in the
        // current set.
@@ -1238,13 +1203,21 @@ __SCNetworkSetEstablishDefaultConfigurationForInterfaces(SCNetworkSetRef set, CF
                services = SCNetworkServiceCopyAll(setPrivate->prefs);
        }
 
+       excluded = copyExcludedInterfaces(setPrivate->prefs);
+
        n = (interfaces != NULL) ? CFArrayGetCount(interfaces) : 0;
        for (i = 0; i < n; i++) {
                SCNetworkInterfaceRef   interface;
                CFMutableArrayRef       interface_list;
 
                interface = CFArrayGetValueAtIndex(interfaces, i);
-               if (_SCNetworkServiceExistsForInterface(services, interface)) {
+               if ((excluded != NULL)
+                   && CFSetContainsValue(excluded, interface)) {
+                       // if this interface is a member of a Bond or Bridge
+                       continue;
+               }
+
+               if (__SCNetworkServiceExistsForInterface(services, interface)) {
                        // if this is not a new interface
                        continue;
                }
@@ -1303,7 +1276,7 @@ __SCNetworkSetEstablishDefaultConfigurationForInterfaces(SCNetworkSetRef set, CF
                                        // we have two interfaces with the same service
                                        // name, acquire a new, hopefully unique, name
 
-                                       newName = next_service_name(service);
+                                       newName = __SCNetworkServiceNextName(service);
                                        if (newName == NULL) {
                                                SCLog(TRUE, LOG_DEBUG,
                                                      CFSTR("could not set unique name for \"%@\": %s\n"),
@@ -1344,6 +1317,30 @@ __SCNetworkSetEstablishDefaultConfigurationForInterfaces(SCNetworkSetRef set, CF
                CFRelease(interface_list);
        }
        if (services != NULL)   CFRelease(services);
+       if (excluded != NULL)   CFRelease(excluded);
+
+#if    TARGET_OS_IPHONE
+       if (orphans != NULL) {
+               if (ok && updated) {
+                       CFIndex i;
+                       CFIndex n       = CFArrayGetCount(orphans);
+
+                       for (i = 0; i < n; i++) {
+                               SCNetworkServiceRef     service;
+
+                               service = CFArrayGetValueAtIndex(orphans, i);
+                               if (_SCNetworkServiceIsVPN(service)) {
+                                       ok = SCNetworkSetAddService(set, service);
+                                       if (!ok) {
+                                               break;
+                                       }
+                               }
+                       }
+               }
+
+               CFRelease(orphans);
+       }
+#endif // TARGET_OS_IPHONE
 
        if (ok && !updated) {
                // if no changes were made
@@ -1357,17 +1354,20 @@ __SCNetworkSetEstablishDefaultConfigurationForInterfaces(SCNetworkSetRef set, CF
 Boolean
 SCNetworkSetEstablishDefaultConfiguration(SCNetworkSetRef set)
 {
-       CFArrayRef      interfaces;
-       Boolean         updated;
+       CFArrayRef              interfaces;
+       SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
+       Boolean                 updated         = FALSE;
 
        if (!isA_SCNetworkSet(set)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
 
-       interfaces = SCNetworkInterfaceCopyAll();
-       updated = __SCNetworkSetEstablishDefaultConfigurationForInterfaces(set, interfaces);
-       if (interfaces != NULL) CFRelease(interfaces);
+       interfaces = _SCNetworkInterfaceCopyAllWithPreferences(setPrivate->prefs);
+       if (interfaces != NULL) {
+               updated = __SCNetworkSetEstablishDefaultConfigurationForInterfaces(set, interfaces);
+               CFRelease(interfaces);
+       }
 
        return updated;
 }
@@ -1376,8 +1376,8 @@ SCNetworkSetEstablishDefaultConfiguration(SCNetworkSetRef set)
 Boolean
 SCNetworkSetEstablishDefaultInterfaceConfiguration(SCNetworkSetRef set, SCNetworkInterfaceRef interface)
 {
-       CFMutableArrayRef       interfaces;
-       Boolean                 updated;
+       CFArrayRef      interfaces;
+       Boolean         updated;
 
        if (!isA_SCNetworkSet(set)) {
                _SCErrorSet(kSCStatusInvalidArgument);
@@ -1389,10 +1389,156 @@ SCNetworkSetEstablishDefaultInterfaceConfiguration(SCNetworkSetRef set, SCNetwor
                return FALSE;
        }
 
-       interfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-       CFArrayAppendValue(interfaces, interface);
+       interfaces = CFArrayCreate(NULL, (const void **)&interface, 1, &kCFTypeArrayCallBacks);
        updated = __SCNetworkSetEstablishDefaultConfigurationForInterfaces(set, interfaces);
        CFRelease(interfaces);
 
        return updated;
 }
+
+
+SCNetworkServiceRef
+SCNetworkSetCopySelectedVPNService(SCNetworkSetRef set)
+{
+       CFIndex                 i;
+       CFIndex                 n;
+       SCNetworkServiceRef     selected        = NULL;
+       CFArrayRef              services;
+       CFMutableArrayRef       services_vpn    = NULL;
+
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       services = SCNetworkSetCopyServices(set);
+       if (services != NULL) {
+               n = CFArrayGetCount(services);
+               for (i = 0; i < n; i++) {
+                       SCNetworkServiceRef     service;
+
+                       service = CFArrayGetValueAtIndex(services, i);
+                       if (!SCNetworkServiceGetEnabled(service)) {
+                               // if not enabled
+                               continue;
+                       }
+
+                       if (!_SCNetworkServiceIsVPN(service)) {
+                               // if not VPN service
+                               continue;
+                       }
+
+                       if (services_vpn == NULL) {
+                               services_vpn = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+                       }
+                       CFArrayAppendValue(services_vpn, service);
+               }
+
+               CFRelease(services);
+       }
+
+       if (services_vpn == NULL) {
+               // if no VPN services
+               return NULL;
+       }
+
+       n = CFArrayGetCount(services_vpn);
+       if (n > 1) {
+               CFArrayRef              order;
+               CFMutableArrayRef       sorted;
+
+               order = SCNetworkSetGetServiceOrder(set);
+               sorted = CFArrayCreateMutableCopy(NULL, 0, services_vpn);
+               CFArraySortValues(sorted,
+                                 CFRangeMake(0, CFArrayGetCount(sorted)),
+                                 _SCNetworkServiceCompare,
+                                 (void *)order);
+               CFRelease(services_vpn);
+               services_vpn = sorted;
+       }
+
+#if    TARGET_OS_IPHONE
+       if (n > 1) {
+               CFStringRef     serviceID_prefs;
+
+#define VPN_PREFERENCES        CFSTR("com.apple.mobilevpn")
+#define VPN_SERVICE_ID CFSTR("activeVPNID")
+
+               CFPreferencesAppSynchronize(VPN_PREFERENCES);
+               serviceID_prefs = CFPreferencesCopyAppValue(VPN_SERVICE_ID, VPN_PREFERENCES);
+               if (serviceID_prefs != NULL) {
+                       for (i = 0; i < n; i++) {
+                               SCNetworkServiceRef     service;
+                               CFStringRef             serviceID;
+
+                               service = CFArrayGetValueAtIndex(services_vpn, i);
+                               serviceID = SCNetworkServiceGetServiceID(service);
+                               if (CFEqual(serviceID, serviceID_prefs)) {
+                                       selected = service;
+                                       CFRetain(selected);
+                                       break;
+                               }
+
+                       }
+
+                       CFRelease(serviceID_prefs);
+               }
+       }
+#endif // TARGET_OS_IPHONE
+
+       if (selected == NULL) {
+               selected = CFArrayGetValueAtIndex(services_vpn, 0);
+               CFRetain(selected);
+       }
+
+       CFRelease(services_vpn);
+       return selected;
+}
+
+
+Boolean
+SCNetworkSetSetSelectedVPNService(SCNetworkSetRef set, SCNetworkServiceRef service)
+{
+       Boolean         ok      = TRUE;
+       CFArrayRef      services;
+
+       if (!isA_SCNetworkSet(set)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (!isA_SCNetworkService(service) || !_SCNetworkServiceIsVPN(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       services = SCNetworkSetCopyServices(set);
+       if (services != NULL) {
+               CFIndex i;
+               CFIndex n       = CFArrayGetCount(services);
+
+               if (!CFArrayContainsValue(services, CFRangeMake(0, n), service)) {
+                       // if selected service not a member of the current set
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       ok = FALSE;
+                       goto done;
+               }
+
+               for (i = 0; ok && (i < n); i++) {
+                       SCNetworkServiceRef     vpn;
+
+                       vpn = CFArrayGetValueAtIndex(services, i);
+                       if (!_SCNetworkServiceIsVPN(vpn)) {
+                               // if not VPN service
+                               continue;
+                       }
+
+                       ok = SCNetworkServiceSetEnabled(vpn, CFEqual(service, vpn));
+               }
+       }
+
+    done :
+
+       if (services != NULL) CFRelease(services);
+       return ok;
+}
index 274bc151390865b1a660d47f2fe35c9d7af08e63..d0296ae8397e1d80daca3d7bb863ac1b6a8a65a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2006, 2011 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -45,6 +45,7 @@
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCNetworkSignature.h"
 #include "SCNetworkSignaturePrivate.h"
+#include <arpa/inet.h>
 
 const char * kSCNetworkSignatureActiveChangedNotifyName = NETWORK_ID_KEY ".active";
 
@@ -168,4 +169,153 @@ SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc)
        return (active);
 }
 
+static CFDictionaryRef
+copy_services_for_address_family(CFAllocatorRef alloc,
+                                SCDynamicStoreRef store, int af)
+{
+       CFDictionaryRef info;
+       CFArrayRef      patterns;
+       CFStringRef     pattern;
+       CFStringRef     prop;
+       Boolean         release_store = FALSE;
+
+       if (store == NULL) {
+               store = store_create(alloc);
+               if (store == NULL) {
+                       return (NULL);
+               }
+               release_store = TRUE;
+       }
+       prop = (af == AF_INET) ? kSCEntNetIPv4 : kSCEntNetIPv6;
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             prop);
+       patterns = CFArrayCreate(NULL,
+                                (const void * *)&pattern, 1,
+                                &kCFTypeArrayCallBacks);
+       CFRelease(pattern);
+       info = SCDynamicStoreCopyMultiple(store, NULL, patterns);
+       CFRelease(patterns);
+       if (release_store) {
+               CFRelease(store);
+       }
+       return (info);
+}
+
+static CFStringRef
+my_IPAddressToCFString(int af, const void * src_p)
+{
+       char            ntopbuf[INET6_ADDRSTRLEN];
+
+       if (inet_ntop(af, src_p, ntopbuf, sizeof(ntopbuf)) != NULL) {
+               return (CFStringCreateWithCString(NULL, ntopbuf,
+                                                 kCFStringEncodingASCII));
+       }
+       return (NULL);
+}
+
+CFStringRef
+SCNetworkSignatureCopyIdentifierForConnectedSocket(CFAllocatorRef alloc,
+                                                  int sock_fd)
+{
+       CFStringRef             addresses_key;
+       int                     af;
+       int                     count;
+       int                     i;
+       const void * *          keys = NULL;
+#define KEYS_STATIC_COUNT      10
+       const void *            keys_static[KEYS_STATIC_COUNT];
+       static const void *     local_ip_p;
+       CFStringRef             local_ip_str = NULL;
+       CFStringRef             ret_signature = NULL;
+       CFDictionaryRef         service_info = NULL;
+       union {
+               struct sockaddr_in      inet;
+               struct sockaddr_in6     inet6;
+               struct sockaddr         sa;
+       }                       ss;
+       socklen_t               ss_len = sizeof(ss);
+       int                     status = kSCStatusFailed;
+
+       if (getsockname(sock_fd, &ss.sa, &ss_len) != 0) {
+               status = kSCStatusInvalidArgument;
+               goto done;
+       }
+       af = ss.inet.sin_family;
+       switch (af) {
+       case AF_INET:
+               addresses_key = kSCPropNetIPv4Addresses;
+               local_ip_p = &ss.inet.sin_addr;
+               break;
+       case AF_INET6:
+               addresses_key = kSCPropNetIPv6Addresses;
+               local_ip_p = &ss.inet6.sin6_addr;
+               break;
+       default:
+               status = kSCStatusInvalidArgument;
+               goto done;
+       }
+
+       /* find a service matching the local IP and get its network signature */
+       service_info = copy_services_for_address_family(alloc, NULL, af);
+       if (service_info == NULL) {
+               goto done;
+       }
+       local_ip_str = my_IPAddressToCFString(af, local_ip_p);
+       if (local_ip_str == NULL) {
+               goto done;
+       }
+       count = CFDictionaryGetCount(service_info);
+       if (count > KEYS_STATIC_COUNT) {
+               keys = (const void * *)malloc(sizeof(*keys) * count);
+       }
+       else {
+               keys = keys_static;
+       }
+       CFDictionaryGetKeysAndValues(service_info, keys, NULL);
+       for (i = 0; i < count; i++) {
+               CFArrayRef              addrs;
+               CFRange                 range;
+               CFStringRef             signature;
+               CFDictionaryRef         value;
+
+               value = CFDictionaryGetValue(service_info, keys[i]);
+               if (isA_CFDictionary(value) == NULL) {
+                       continue;
+               }
+               signature = CFDictionaryGetValue(value,
+                                                kStoreKeyNetworkSignature);
+               if (isA_CFString(signature) == NULL) {
+                       /* no signature */
+                       continue;
+               }
+               addrs = CFDictionaryGetValue(value, addresses_key);
+               if (isA_CFArray(addrs) == NULL) {
+                       continue;
+               }
+               range = CFRangeMake(0, CFArrayGetCount(addrs));
+               if (CFArrayContainsValue(addrs, range, local_ip_str)) {
+                       ret_signature = CFRetain(signature);
+                       status = kSCStatusOK;
+                       break;
+               }
+       }
+
+ done:
+       if (local_ip_str != NULL) {
+               CFRelease(local_ip_str);
+       }
+       if (keys != NULL && keys != keys_static) {
+               free(keys);
+       }
+       if (service_info != NULL) {
+               CFRelease(service_info);
+       }
+       if (status != kSCStatusOK) {
+               _SCErrorSet(status);
+       }
+       return (ret_signature);
+}
+
 #pragma mark -
index c065caa177639a8fefe87ad1a6f6636c110aa555..41bd0d7f96026e82c37769736700650571dcc8dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2006, 2008, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -81,4 +81,21 @@ CFStringRef
 SCNetworkSignatureCopyActiveIdentifierForAddress(CFAllocatorRef alloc,
                                                 const struct sockaddr * addr)  __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
+/*!
+       @function SCNetworkSignatureCopyIdentifierForConnectedSocket
+       @discussion Find the identifier for the given file descriptor
+               corresponding to a connected socket.
+       @param allocator The CFAllocator that should be used to allocate
+               memory for the local dynamic store object.
+               This parameter may be NULL in which case the current
+               default CFAllocator is used. If this reference is not
+               a valid CFAllocator, the behavior is undefined.
+       @param sock_fd The socket file descriptor, must be either AF_INET
+               or AF_INET6.
+       @result The unique (string) identifier associated with the address,
+               NULL if no network is known.
+ */
+CFStringRef
+SCNetworkSignatureCopyIdentifierForConnectedSocket(CFAllocatorRef alloc,
+                                                  int sock_fd) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
 #endif /* _SCNETWORKSIGNATURE_H */
index 71fc457fafb2595473ba075d3bb253136fb7a687..55219f069915d75af34d059117baa2d8e08da90d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2006, 2011 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -32,4 +32,6 @@
 #define kStoreKeyActiveIdentifiers     CFSTR("ActiveIdentifiers")
 #define kStoreKeyPrimaryIPv4Identifier         CFSTR("PrimaryIPv4Identifier")
 
+#define kStoreKeyNetworkSignature      CFSTR("NetworkSignature")
+
 #endif /* _SCNETWORKSIGNATUREPRIVATE_H */
index 1acfe1d1e910cc0bbd1903c949242c145372eb8b..fc79654406f418bdd373334f2e1655a453ffaa74 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -137,6 +137,9 @@ _SCPNotificationKey(CFAllocatorRef  allocator,
        CFStringRef     storeKey;
 
        switch (keyType) {
+               case kSCPreferencesKeyLock :
+                       keyStr = CFSTR("lock");
+                       break;
                case kSCPreferencesKeyCommit :
                        keyStr = CFSTR("commit");
                        break;
index 720ab46a612650a8ed0deb31e2ceb81c9639d887..f913dc98e304d2894668878fe26e46fdbe52e1a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004-2006, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -44,14 +44,14 @@ __SCPreferencesApplyChanges_helper(SCPreferencesRef prefs)
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        uint32_t                status          = kSCStatusOK;
 
-       if (prefsPrivate->helper == -1) {
+       if (prefsPrivate->helper_port == MACH_PORT_NULL) {
                // if no helper
                goto fail;
        }
 
        // have the helper "apply" the prefs
 //     status = kSCStatusOK;
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           SCHELPER_MSG_PREFS_APPLY,
                           NULL,
                           &status,
@@ -69,9 +69,8 @@ __SCPreferencesApplyChanges_helper(SCPreferencesRef prefs)
     fail :
 
        // close helper
-       if (prefsPrivate->helper != -1) {
-               _SCHelperClose(prefsPrivate->helper);
-               prefsPrivate->helper = -1;
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
        status = kSCStatusAccessError;
@@ -127,6 +126,12 @@ SCPreferencesApplyChanges(SCPreferencesRef prefs)
 
     done :
 
-       if (!wasLocked) (void) SCPreferencesUnlock(prefs);
+       if (!wasLocked) {
+               uint32_t        status;
+
+               status = SCError();     // preserve status across unlock
+               (void) SCPreferencesUnlock(prefs);
+               _SCErrorSet(status);
+       }
        return ok;
 }
index c380dc068fda442246365999dedb330a3dc8d3d1..6f193c1712e49fb9fb0566a285bae2eeeaaca107 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008, 2010, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -31,6 +31,7 @@
  * - initial revision
  */
 
+#include <TargetConditionals.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
@@ -49,22 +50,24 @@ __SCPreferencesCommitChanges_helper(SCPreferencesRef prefs)
        uint32_t                status          = kSCStatusOK;
        CFDataRef               reply           = NULL;
 
-       if (prefsPrivate->helper == -1) {
+       if (prefsPrivate->helper_port == MACH_PORT_NULL) {
                // if no helper
+               status = kSCStatusAccessError;
                goto fail;
        }
 
        if (prefsPrivate->changed) {
                ok = _SCSerialize(prefsPrivate->prefs, &data, NULL, NULL);
                if (!ok) {
-                       goto fail;
+                       status = kSCStatusFailed;
+                       goto error;
                }
        }
 
        // have the helper "commit" the prefs
 //     status = kSCStatusOK;
 //     reply  = NULL;
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           SCHELPER_MSG_PREFS_COMMIT,
                           data,
                           &status,
@@ -81,6 +84,8 @@ __SCPreferencesCommitChanges_helper(SCPreferencesRef prefs)
        if (prefsPrivate->changed) {
                if (prefsPrivate->signature != NULL) CFRelease(prefsPrivate->signature);
                prefsPrivate->signature = reply;
+       } else {
+               if (reply != NULL) CFRelease(reply);
        }
 
        prefsPrivate->changed = FALSE;
@@ -89,13 +94,10 @@ __SCPreferencesCommitChanges_helper(SCPreferencesRef prefs)
     fail :
 
        // close helper
-       if (prefsPrivate->helper != -1) {
-               _SCHelperClose(prefsPrivate->helper);
-               prefsPrivate->helper = -1;
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
-       status = kSCStatusAccessError;
-
     error :
 
        // return error
@@ -130,7 +132,10 @@ Boolean
 SCPreferencesCommitChanges(SCPreferencesRef prefs)
 {
        Boolean                 ok              = FALSE;
+       char *                  path;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       Boolean                 save            = TRUE;
+       struct stat             statBuf;
        Boolean                 wasLocked;
 
        if (prefs == NULL) {
@@ -162,12 +167,33 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
        /*
         * if necessary, apply changes
         */
-       if (prefsPrivate->changed) {
+       if (!prefsPrivate->changed) {
+               goto committed;
+       }
+
+       /*
+        * check if the preferences should be removed
+        */
+       if (CFDictionaryGetCount(prefsPrivate->prefs) == 0) {
+               CFBooleanRef    val;
+
+               /* if empty */
+               if ((prefsPrivate->options != NULL) &&
+                   CFDictionaryGetValueIfPresent(prefsPrivate->options,
+                                                 kSCPreferencesOptionRemoveWhenEmpty,
+                                                 (const void **)&val) &&
+                   isA_CFBoolean(val) &&
+                   CFBooleanGetValue(val)) {
+                       /* if we've been asked to remove empty .plists */
+                       save = FALSE;
+               }
+       }
+
+       path = prefsPrivate->newPath ? prefsPrivate->newPath : prefsPrivate->path;
+       if (save) {
                int             fd;
                CFDataRef       newPrefs;
-               char *          path;
                int             pathLen;
-               struct stat     statBuf;
                char *          thePath;
 
                if (stat(prefsPrivate->path, &statBuf) == -1) {
@@ -183,7 +209,6 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                }
 
                /* create the (new) preferences file */
-               path = prefsPrivate->newPath ? prefsPrivate->newPath : prefsPrivate->path;
                pathLen = strlen(path) + sizeof("-new");
                thePath = CFAllocatorAllocate(NULL, pathLen, 0);
                snprintf(thePath, pathLen, "%s-new", path);
@@ -201,10 +226,18 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                (void) fchmod(fd, statBuf.st_mode);
 
                /* write the new preferences */
-               newPrefs = CFPropertyListCreateXMLData(NULL, prefsPrivate->prefs);
+               newPrefs = CFPropertyListCreateData(NULL,
+                                                   prefsPrivate->prefs,
+#if    TARGET_OS_IPHONE
+                                                   kCFPropertyListBinaryFormat_v1_0,
+#else  // TARGET_OS_IPHONE
+                                                   kCFPropertyListXMLFormat_v1_0,
+#endif // TARGET_OS_IPHONE
+                                                   0,
+                                                   NULL);
                if (!newPrefs) {
                        _SCErrorSet(kSCStatusFailed);
-                       SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges CFPropertyListCreateXMLData() failed"));
+                       SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges CFPropertyListCreateData() failed"));
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("  prefs = %s"), path);
                        CFAllocatorDeallocate(NULL, thePath);
                        (void) close(fd);
@@ -273,17 +306,27 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                        prefsPrivate->newPath = NULL;
                }
 
-               /* update signature */
+               /* grab the new signature */
                if (stat(path, &statBuf) == -1) {
                        _SCErrorSet(errno);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges stat() failed: %s"), strerror(errno));
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("  path = %s"), thePath);
                        goto done;
                }
-               if (prefsPrivate->signature != NULL) CFRelease(prefsPrivate->signature);
-               prefsPrivate->signature = __SCPSignatureFromStatbuf(&statBuf);
+       } else {
+               /* remove the empty .plist */
+               unlink(path);
+
+               /* init the new signature */
+               bzero(&statBuf, sizeof(statBuf));
        }
 
+       /* update signature */
+       if (prefsPrivate->signature != NULL) CFRelease(prefsPrivate->signature);
+       prefsPrivate->signature = __SCPSignatureFromStatbuf(&statBuf);
+
+    committed :
+
        /* post notification */
        if (prefsPrivate->session == NULL) {
                ok = TRUE;
@@ -300,6 +343,12 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
 
     done :
 
-       if (!wasLocked) (void) SCPreferencesUnlock(prefs);
+       if (!wasLocked) {
+               uint32_t        status;
+
+               status = SCError();     // preserve status across unlock
+               (void) SCPreferencesUnlock(prefs);
+               _SCErrorSet(status);
+       }
        return ok;
 }
index 3bffe8b093c7742784577f900b4a2ea2db9c0491..fe2eca092e812ceb9beb82d273cda61d404db0bc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -31,6 +31,7 @@
  * - initial revision
  */
 
+#include <TargetConditionals.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <pthread.h>
+#include <sys/attr.h>
 #include <sys/errno.h>
+#include <sys/mount.h>
+#include <sys/param.h>
 
 
 
-#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)
 {
@@ -63,7 +57,7 @@ __SCPreferencesLock_helper(SCPreferencesRef prefs, Boolean wait)
        uint32_t                status          = kSCStatusOK;
        CFDataRef               reply           = NULL;
 
-       if (prefsPrivate->helper == -1) {
+       if (prefsPrivate->helper_port == MACH_PORT_NULL) {
                ok = __SCPreferencesCreate_helper(prefs);
                if (!ok) {
                        return FALSE;
@@ -73,7 +67,7 @@ __SCPreferencesLock_helper(SCPreferencesRef prefs, Boolean wait)
        // have the helper "lock" the prefs
        status = kSCStatusOK;
        reply  = NULL;
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           wait ? SCHELPER_MSG_PREFS_LOCKWAIT : SCHELPER_MSG_PREFS_LOCK,
                           prefsPrivate->signature,
                           &status,
@@ -92,9 +86,8 @@ __SCPreferencesLock_helper(SCPreferencesRef prefs, Boolean wait)
     fail :
 
        // close helper
-       if (prefsPrivate->helper != -1) {
-               _SCHelperClose(prefsPrivate->helper);
-               prefsPrivate->helper = -1;
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
        status = kSCStatusAccessError;
@@ -130,15 +123,9 @@ createParentDirectory(const char *path)
 
        // create parent directories
        for (scan = dir; TRUE; scan = slash) {
-               mode_t  mode;
+               mode_t  mode    = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;      // 755
                char    sep     = '\0';
 
-               if ((slash == NULL) || (scan == dir)) {
-                       mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; // 755
-               } else {
-                       mode = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH;         // 775
-               }
-
                if (slash != NULL) {
                        sep = *slash;
                        *slash = '\0';
@@ -146,26 +133,26 @@ createParentDirectory(const char *path)
 
                ret = mkdir(dir, mode);
                if (ret == 0) {
-                       static  gid_t   admin   = -1;
+                       static  gid_t   group   = -1;
 
                        // set group
-                       if (admin == -1) {
+                       if (group == -1) {
                                char            buf[256];
                                struct group    grp;
                                struct group    *grpP   = NULL;
 
-                               if ((getgrnam_r("admin", &grp, buf, sizeof(buf), &grpP) == 0) &&
+                               if ((getgrnam_r("wheel", &grp, buf, sizeof(buf), &grpP) == 0) &&
                                    (grpP != NULL)) {
-                                       admin = grpP->gr_gid;
+                                       group = grpP->gr_gid;
                                } else {
                                        SCLog(TRUE, LOG_ERR,
                                              CFSTR("SCPreferencesLock getgrnam_r() failed: %s"),
                                              strerror(errno));
-                                       admin = 80;
+                                       group = 0;      // wheel
                                }
                        }
 
-                       if (chown(dir, -1, admin) == -1) {
+                       if (chown(dir, -1, group) == -1) {
                                SCLog(TRUE, LOG_ERR,
                                      CFSTR("SCPreferencesLock chown() failed: %s"),
                                      strerror(errno));
@@ -236,6 +223,135 @@ reportDelay(SCPreferencesRef prefs, struct timeval *delay, Boolean isStale)
 }
 
 
+static Boolean
+has_O_EXLOCK(SCPreferencesPrivateRef prefsPrivate)
+{
+#pragma pack(push, 4)
+       struct {
+               u_int32_t               size;
+               vol_capabilities_attr_t capabilities;
+       } attrbuf;
+#pragma pack(pop)
+       struct attrlist                 attrs;
+       int                             fd;
+       int                             ret;
+       struct statfs                   statbuf;
+
+       fd = open(prefsPrivate->lockPath, O_WRONLY|O_CREAT, 0644);
+       if (fd == -1) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCPreferencesLock open() failed: %s"),
+                     strerror(errno));
+               return FALSE;
+       }
+
+       ret = fstatfs(fd, &statbuf);
+       unlink(prefsPrivate->lockPath);
+       close(fd);
+       if (ret == -1) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCPreferencesLock fstatfs() failed: %s"),
+                     strerror(errno));
+               return FALSE;
+       }
+
+       bzero(&attrs, sizeof(attrs));
+       attrs.bitmapcount = ATTR_BIT_MAP_COUNT;
+       attrs.volattr     = ATTR_VOL_INFO | ATTR_VOL_CAPABILITIES;
+       bzero(&attrbuf, sizeof(attrbuf));
+       ret = getattrlist(statbuf.f_mntonname,  // path (of mount point)
+                         &attrs,               // attribute list
+                         &attrbuf,             // attribute buffer
+                         sizeof(attrbuf),
+                         0);                   // options
+       if (ret == -1) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCPreferencesLock getattrlist() failed: %s"),
+                     strerror(errno));
+               return FALSE;
+       }
+
+       if ((attrbuf.capabilities.capabilities[VOL_CAPABILITIES_INTERFACES] & VOL_CAP_INT_FLOCK) &&
+           (attrbuf.capabilities.valid       [VOL_CAPABILITIES_INTERFACES] & VOL_CAP_INT_FLOCK)) {
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+
+static Boolean
+lockWithSCDynamicStore(SCPreferencesPrivateRef prefsPrivate, Boolean wait)
+{
+       CFArrayRef      changes;
+       Boolean         locked          = FALSE;
+       Boolean         ok;
+       int             sc_status       = kSCStatusOK;
+
+       // add [lock] notification
+       ok = SCDynamicStoreAddWatchedKey(prefsPrivate->session,
+                                        prefsPrivate->sessionKeyLock,
+                                        FALSE);
+       if (!ok) {
+               sc_status = SCError();
+               SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesLock SCDynamicStoreAddWatchedKey() failed"));
+       }
+
+       while (ok) {
+               CFDateRef       value;
+
+               // Attempt to acquire the lock
+               value = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent());
+               ok = SCDynamicStoreAddTemporaryValue(prefsPrivate->session,
+                                                    prefsPrivate->sessionKeyLock,
+                                                    value);
+               CFRelease(value);
+               if (ok) {
+                       locked = TRUE;
+                       break;
+               }
+
+               if (!wait) {
+                       sc_status = kSCStatusPrefsBusy;
+                       break;
+               }
+
+               // wait for the lock to be released
+               ok = SCDynamicStoreNotifyWait(prefsPrivate->session);
+               if (!ok) {
+                       sc_status = SCError();
+                       SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesLock SCDynamicStoreNotifyWait() failed"));
+                       break;
+               }
+
+               // clear out any notifications
+               changes = SCDynamicStoreCopyNotifiedKeys(prefsPrivate->session);
+               if (changes != NULL) {
+                       CFRelease(changes);
+               } else {
+                       SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesLock SCDynamicStoreCopyNotifiedKeys() failed"));
+                       break;
+               }
+       }
+
+       // remove [lock] notification
+       (void) SCDynamicStoreRemoveWatchedKey(prefsPrivate->session,
+                                             prefsPrivate->sessionKeyLock,
+                                             0);
+
+       // clear out any notifications
+       changes = SCDynamicStoreCopyNotifiedKeys(prefsPrivate->session);
+       if (changes != NULL) {
+               CFRelease(changes);
+       }
+
+       if (sc_status != kSCStatusOK) {
+               _SCErrorSet(sc_status);
+       }
+       return locked;
+}
+
+
 Boolean
 SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
 {
@@ -289,6 +405,14 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
 
     retry :
 
+       if (prefsPrivate->sessionKeyLock != NULL) {
+               if (lockWithSCDynamicStore(prefsPrivate, wait)) {
+                       goto locked;
+               }
+
+               goto error;
+       }
+
        prefsPrivate->lockFD = open(prefsPrivate->lockPath,
                                    wait ? O_WRONLY|O_CREAT|O_EXLOCK
                                         : O_WRONLY|O_CREAT|O_EXLOCK|O_NONBLOCK,
@@ -319,6 +443,16 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
                                // if already locked (and we are not blocking)
                                sc_status = kSCStatusPrefsBusy;
                                goto error;
+                       case ENOTSUP :
+                               if (!has_O_EXLOCK(prefsPrivate)) {
+                                       // O_EXLOCK *not* available, use SCDynamicStore
+                                       prefsPrivate->sessionKeyLock = _SCPNotificationKey(NULL,
+                                                                                          prefsPrivate->prefsID,
+                                                                                          kSCPreferencesKeyLock);
+                                       goto retry;
+                               }
+                               errno = ENOTSUP;
+                               break;
                        default :
                                break;
                }
index 9dfde1d1c16bcf8f1c7a40a67497c383f6729f8b..b6fa4541ac66e4b004c749d30d92f55943e3aae5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2000-2009 Apple Inc. All rights reserved.
+ * Copyright(c) 2000-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -37,9 +37,7 @@
 #include <Availability.h>
 #include <TargetConditionals.h>
 #include <sys/cdefs.h>
-#if    !TARGET_OS_IPHONE
 #include <dispatch/dispatch.h>
-#endif // !TARGET_OS_IPHONE
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
@@ -49,6 +47,7 @@
 #include "dy_framework.h"
 
 #include <fcntl.h>
+#include <libproc.h>
 #include <pthread.h>
 #include <unistd.h>
 #include <sys/errno.h>
@@ -82,8 +81,8 @@ __SCPreferencesCopyDescription(CFTypeRef cf) {
        if (prefsPrivate->locked) {
                CFStringAppendFormat(result, NULL, CFSTR(", locked"));
        }
-       if (prefsPrivate->helper != -1) {
-               CFStringAppendFormat(result, NULL, CFSTR(", helper fd=%d"), prefsPrivate->helper);
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", helper port = %p"), prefsPrivate->helper_port);
        }
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
@@ -102,6 +101,7 @@ __SCPreferencesDeallocate(CFTypeRef cf)
 
        if (prefsPrivate->name)                 CFRelease(prefsPrivate->name);
        if (prefsPrivate->prefsID)              CFRelease(prefsPrivate->prefsID);
+       if (prefsPrivate->options)              CFRelease(prefsPrivate->options);
        if (prefsPrivate->path)                 CFAllocatorDeallocate(NULL, prefsPrivate->path);
        if (prefsPrivate->newPath)              CFAllocatorDeallocate(NULL, prefsPrivate->newPath);
        if (prefsPrivate->lockFD != -1) {
@@ -113,6 +113,7 @@ __SCPreferencesDeallocate(CFTypeRef cf)
        if (prefsPrivate->lockPath)             CFAllocatorDeallocate(NULL, prefsPrivate->lockPath);
        if (prefsPrivate->signature)            CFRelease(prefsPrivate->signature);
        if (prefsPrivate->session)              CFRelease(prefsPrivate->session);
+       if (prefsPrivate->sessionKeyLock)       CFRelease(prefsPrivate->sessionKeyLock);
        if (prefsPrivate->sessionKeyCommit)     CFRelease(prefsPrivate->sessionKeyCommit);
        if (prefsPrivate->sessionKeyApply)      CFRelease(prefsPrivate->sessionKeyApply);
        if (prefsPrivate->rlsContext.release != NULL) {
@@ -120,9 +121,13 @@ __SCPreferencesDeallocate(CFTypeRef cf)
        }
        if (prefsPrivate->prefs)                CFRelease(prefsPrivate->prefs);
        if (prefsPrivate->authorizationData != NULL) CFRelease(prefsPrivate->authorizationData);
-       if (prefsPrivate->helper != -1) {
-               (void) _SCHelperExec(prefsPrivate->helper, SCHELPER_MSG_PREFS_CLOSE, NULL, NULL, NULL);
-               _SCHelperClose(prefsPrivate->helper);
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               (void) _SCHelperExec(prefsPrivate->helper_port,
+                                    SCHELPER_MSG_PREFS_CLOSE,
+                                    NULL,
+                                    NULL,
+                                    NULL);
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
        return;
@@ -177,6 +182,7 @@ __SCPreferencesCreatePrivate(CFAllocatorRef allocator)
 
        prefsPrivate->name                              = NULL;
        prefsPrivate->prefsID                           = NULL;
+       prefsPrivate->options                           = NULL;
        prefsPrivate->path                              = NULL;
        prefsPrivate->newPath                           = NULL;         // new prefs path
        prefsPrivate->locked                            = FALSE;
@@ -184,6 +190,7 @@ __SCPreferencesCreatePrivate(CFAllocatorRef allocator)
        prefsPrivate->lockPath                          = NULL;
        prefsPrivate->signature                         = NULL;
        prefsPrivate->session                           = NULL;
+       prefsPrivate->sessionKeyLock                    = NULL;
        prefsPrivate->sessionKeyCommit                  = NULL;
        prefsPrivate->sessionKeyApply                   = NULL;
        prefsPrivate->scheduled                         = FALSE;
@@ -194,15 +201,13 @@ __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;
        prefsPrivate->isRoot                            = (geteuid() == 0);
        prefsPrivate->authorizationData                 = NULL;
-       prefsPrivate->helper                            = -1;
+       prefsPrivate->helper_port                       = MACH_PORT_NULL;
 
        return prefsPrivate;
 }
@@ -213,15 +218,18 @@ __SCPreferencesCreate_helper(SCPreferencesRef prefs)
 {
        CFDataRef               data            = NULL;
        CFMutableDictionaryRef  info;
+       char                    name[64]        = "???";
        CFNumberRef             num;
        Boolean                 ok;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        uint32_t                status          = kSCStatusOK;
+       CFStringRef             str;
        uint32_t                pid             = getpid();
 
        // start helper
-       prefsPrivate->helper = _SCHelperOpen(prefsPrivate->authorizationData);
-       if (prefsPrivate->helper == -1) {
+       ok = _SCHelperOpen(prefsPrivate->authorizationData,
+                          &prefsPrivate->helper_port);
+       if (!ok) {
                goto fail;
        }
 
@@ -230,14 +238,31 @@ __SCPreferencesCreate_helper(SCPreferencesRef prefs)
                                         0,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
+
+       // save prefsID
        if (prefsPrivate->prefsID != NULL) {
                CFDictionarySetValue(info, CFSTR("prefsID"), prefsPrivate->prefsID);
        }
+
+       // save options
+       if (prefsPrivate->options != NULL) {
+               CFDictionarySetValue(info, CFSTR("options"), prefsPrivate->options);
+       }
+
+       // save preferences session "name"
        CFDictionarySetValue(info, CFSTR("name"), prefsPrivate->name);
+
+       // save PID
        num = CFNumberCreate(NULL, kCFNumberSInt32Type, &pid);
        CFDictionarySetValue(info, CFSTR("PID"), num);
        CFRelease(num);
 
+       // save process name
+       (void) proc_name(getpid(), name, sizeof(name));
+       str = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8);
+       CFDictionarySetValue(info, CFSTR("PROC_NAME"), str);
+       CFRelease(str);
+
        // serialize the info
        ok = _SCSerialize(info, &data, NULL, NULL);
        CFRelease(info);
@@ -246,7 +271,7 @@ __SCPreferencesCreate_helper(SCPreferencesRef prefs)
        }
 
        // have the helper "open" the prefs
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           SCHELPER_MSG_PREFS_OPEN,
                           data,
                           &status,
@@ -265,9 +290,8 @@ __SCPreferencesCreate_helper(SCPreferencesRef prefs)
     fail :
 
        // close helper
-       if (prefsPrivate->helper != -1) {
-               _SCHelperClose(prefsPrivate->helper);
-               prefsPrivate->helper = -1;
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
        status = kSCStatusAccessError;
@@ -291,7 +315,7 @@ __SCPreferencesAccess_helper(SCPreferencesRef prefs)
        uint32_t                status          = kSCStatusOK;
        CFDataRef               reply           = NULL;
 
-       if (prefsPrivate->helper == -1) {
+       if (prefsPrivate->helper_port == MACH_PORT_NULL) {
                ok = __SCPreferencesCreate_helper(prefs);
                if (!ok) {
                        return FALSE;
@@ -299,7 +323,7 @@ __SCPreferencesAccess_helper(SCPreferencesRef prefs)
        }
 
        // have the helper "access" the prefs
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           SCHELPER_MSG_PREFS_ACCESS,
                           NULL,
                           &status,
@@ -323,11 +347,14 @@ __SCPreferencesAccess_helper(SCPreferencesRef prefs)
        }
 
        if (isA_CFDictionary(serverDict)) {
-               serverPrefs     = CFDictionaryGetValue(serverDict, CFSTR("preferences"));
+               serverPrefs = CFDictionaryGetValue(serverDict, CFSTR("preferences"));
+               serverPrefs = isA_CFDictionary(serverPrefs);
+
                serverSignature = CFDictionaryGetValue(serverDict, CFSTR("signature"));
+               serverSignature = isA_CFData(serverSignature);
        }
 
-       if (!isA_CFDictionary(serverPrefs) || !isA_CFData(serverSignature)) {
+       if ((serverPrefs == NULL) || (serverSignature == NULL)) {
                CFRelease(serverDict);
                goto fail;
        }
@@ -342,9 +369,8 @@ __SCPreferencesAccess_helper(SCPreferencesRef prefs)
     fail :
 
        // close helper
-       if (prefsPrivate->helper != -1) {
-               _SCHelperClose(prefsPrivate->helper);
-               prefsPrivate->helper = -1;
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
        status = kSCStatusAccessError;
@@ -361,7 +387,8 @@ static SCPreferencesPrivateRef
 __SCPreferencesCreate(CFAllocatorRef   allocator,
                      CFStringRef       name,
                      CFStringRef       prefsID,
-                     CFDataRef         authorizationData)
+                     CFDataRef         authorizationData,
+                     CFDictionaryRef   options)
 {
        int                             fd              = -1;
        SCPreferencesPrivateRef         prefsPrivate;
@@ -382,6 +409,9 @@ __SCPreferencesCreate(CFAllocatorRef        allocator,
        if (authorizationData != NULL) {
                prefsPrivate->authorizationData = CFRetain(authorizationData);
        }
+       if (options != NULL) {
+               prefsPrivate->options = CFDictionaryCreateCopy(allocator, options);
+       }
 
     retry :
 
@@ -512,8 +542,8 @@ __SCPreferencesAccess(SCPreferencesRef      prefs)
 
        if (statBuf.st_size > 0) {
                CFDictionaryRef         dict;
+               CFErrorRef              error;
                CFMutableDataRef        xmlData;
-               CFStringRef             xmlError;
 
                /*
                 * extract property list
@@ -531,18 +561,15 @@ __SCPreferencesAccess(SCPreferencesRef    prefs)
                /*
                 * load preferences
                 */
-               dict = CFPropertyListCreateFromXMLData(allocator,
-                                                      xmlData,
-                                                      kCFPropertyListImmutable,
-                                                      &xmlError);
+               dict = CFPropertyListCreateWithData(allocator, xmlData, kCFPropertyListImmutable, NULL, &error);
                CFRelease(xmlData);
                if (dict == NULL) {
                        /* corrupt prefs file, start fresh */
-                       if (xmlError != NULL) {
+                       if (error != NULL) {
                                SCLog(TRUE, LOG_ERR,
-                                     CFSTR("__SCPreferencesAccess CFPropertyListCreateFromXMLData(): %@"),
-                                     xmlError);
-                               CFRelease(xmlError);
+                                     CFSTR("__SCPreferencesAccess CFPropertyListCreateWithData(): %@"),
+                                     error);
+                               CFRelease(error);
                        }
                        goto done;
                }
@@ -591,7 +618,7 @@ SCPreferencesCreate(CFAllocatorRef          allocator,
 {
        SCPreferencesPrivateRef prefsPrivate;
 
-       prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, NULL);
+       prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, NULL, NULL);
        return (SCPreferencesRef)prefsPrivate;
 }
 
@@ -601,59 +628,86 @@ SCPreferencesCreateWithAuthorization(CFAllocatorRef       allocator,
                                     CFStringRef        name,
                                     CFStringRef        prefsID,
                                     AuthorizationRef   authorization)
+{
+       SCPreferencesRef        prefs;
+
+#if    TARGET_OS_IPHONE
+       authorization = (AuthorizationRef)1;
+#endif // TARGET_OS_IPHONE
+
+       prefs = SCPreferencesCreateWithOptions(allocator, name, prefsID, authorization, NULL);
+       return prefs;
+}
+
+
+SCPreferencesRef
+SCPreferencesCreateWithOptions(CFAllocatorRef  allocator,
+                              CFStringRef      name,
+                              CFStringRef      prefsID,
+                              AuthorizationRef authorization,
+                              CFDictionaryRef  options)
 {
        CFDataRef                       authorizationData       = NULL;
        SCPreferencesPrivateRef         prefsPrivate;
 
+       if (options != NULL) {
+               if (!isA_CFDictionary(options)) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+       }
+
+       if (authorization != NULL) {
 #if    !TARGET_OS_IPHONE
-       AuthorizationExternalForm       extForm;
-       OSStatus                        os_status;
+               AuthorizationExternalForm       extForm;
+               OSStatus                        os_status;
 
-       os_status = AuthorizationMakeExternalForm(authorization, &extForm);
-       if (os_status != errAuthorizationSuccess) {
-               SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen AuthorizationMakeExternalForm() failed"));
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
-       }
+               os_status = AuthorizationMakeExternalForm(authorization, &extForm);
+               if (os_status != errAuthorizationSuccess) {
+                       SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen AuthorizationMakeExternalForm() failed"));
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
 
-       authorizationData = CFDataCreate(NULL, (const UInt8 *)extForm.bytes, sizeof(extForm.bytes));
+               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);
+               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) {
+                               if (CFEqual(bundleID, CFSTR("/"))) {
+                                       CFRelease(bundleID);
+                                       bundleID = NULL;
+                               }
                        }
                }
-       }
-       if (bundleID == NULL) {
-               bundleID = CFStringCreateWithFormat(NULL, NULL, CFSTR("Unknown(%d)"), getpid());
-       }
+               if (bundleID == NULL) {
+                       bundleID = CFStringCreateWithFormat(NULL, NULL, CFSTR("Unknown(%d)"), getpid());
+               }
 
-       _SCSerializeString(bundleID, &authorizationData, NULL, NULL);
-       CFRelease(bundleID);
+               _SCSerializeString(bundleID, &authorizationData, NULL, NULL);
+               CFRelease(bundleID);
 #endif // !TARGET_OS_IPHONE
+       }
 
-       prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, authorizationData);
-       CFRelease(authorizationData);
+       prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, authorizationData, options);
+       if (authorizationData != NULL) CFRelease(authorizationData);
 
        return (SCPreferencesRef)prefsPrivate;
 }
@@ -802,25 +856,18 @@ 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
-                                  )
+                                  dispatch_queue_t     queue)
 {
        Boolean                 ok              = FALSE;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
 
        pthread_mutex_lock(&prefsPrivate->lock);
 
-#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;
@@ -848,7 +895,6 @@ __SCPreferencesScheduleWithRunLoop(SCPreferencesRef prefs,
                prefsPrivate->scheduled = TRUE;
        }
 
-#if    !TARGET_OS_IPHONE
        if (queue != NULL) {
                ok = SCDynamicStoreSetDispatchQueue(prefsPrivate->session, queue);
                if (!ok) {
@@ -860,9 +906,7 @@ __SCPreferencesScheduleWithRunLoop(SCPreferencesRef prefs,
 
                prefsPrivate->dispatchQueue = queue;
                dispatch_retain(prefsPrivate->dispatchQueue);
-       } else
-#endif // !TARGET_OS_IPHONE
-       {
+       } else {
                if (!_SC_isScheduled(NULL, runLoop, runLoopMode, prefsPrivate->rlList)) {
                        /*
                         * if we do not already have notifications scheduled with
@@ -899,22 +943,17 @@ __SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef     prefs,
                goto done;
        }
 
-#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
-       {
+       } else {
                if (!_SC_unschedule(prefs, runLoop, runLoopMode, prefsPrivate->rlList, FALSE)) {
                        // if not currently scheduled on this runLoop / runLoopMode
                        _SCErrorSet(kSCStatusInvalidArgument);
@@ -967,6 +1006,7 @@ __SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef      prefs,
        return ok;
 }
 
+
 Boolean
 SCPreferencesScheduleWithRunLoop(SCPreferencesRef       prefs,
                                 CFRunLoopRef           runLoop,
@@ -980,6 +1020,7 @@ SCPreferencesScheduleWithRunLoop(SCPreferencesRef       prefs,
        return __SCPreferencesScheduleWithRunLoop(prefs, runLoop, runLoopMode, NULL);
 }
 
+
 Boolean
 SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef     prefs,
                                   CFRunLoopRef         runLoop,
@@ -993,7 +1034,7 @@ SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef     prefs,
        return __SCPreferencesUnscheduleFromRunLoop(prefs, runLoop, runLoopMode);
 }
 
-#if    !TARGET_OS_IPHONE
+
 Boolean
 SCPreferencesSetDispatchQueue(SCPreferencesRef prefs,
                              dispatch_queue_t  queue)
@@ -1014,7 +1055,6 @@ SCPreferencesSetDispatchQueue(SCPreferencesRef    prefs,
 
        return ok;
 }
-#endif // !TARGET_OS_IPHONE
 
 
 static void
@@ -1024,22 +1064,21 @@ __SCPreferencesSynchronize_helper(SCPreferencesRef prefs)
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        uint32_t                status          = kSCStatusOK;
 
-       if (prefsPrivate->helper == -1) {
+       if (prefsPrivate->helper_port == MACH_PORT_NULL) {
                // if no helper
                return;
        }
 
        // have the helper "synchronize" the prefs
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           SCHELPER_MSG_PREFS_SYNCHRONIZE,
                           NULL,
                           &status,
                           NULL);
        if (!ok) {
                // close helper
-               if (prefsPrivate->helper != -1) {
-                       _SCHelperClose(prefsPrivate->helper);
-                       prefsPrivate->helper = -1;
+               if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+                       _SCHelperClose(&prefsPrivate->helper_port);
                }
        }
 
index c3d5b5f6f4be2407cc74f83c8474d0cfcb9cfc5f..07945535140d94294df7f430ab1a6deaf3eea25a 100644 (file)
 
 #define        MAXLINKS        8
 
-static CFArrayRef
+static CFMutableArrayRef
 normalizePath(CFStringRef path)
 {
-       CFArrayRef              tmpElements;
        CFMutableArrayRef       elements;
-       CFIndex                 nElements;
-       CFIndex                 i;
+       CFIndex                 n;
+       CFArrayRef              tmpElements;
+
+       if (!isA_CFString(path)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
 
        if (!CFStringHasPrefix(path, CFSTR("/"))) {
                /* if no root separator */
@@ -56,14 +60,13 @@ normalizePath(CFStringRef path)
        CFRelease(tmpElements);
 
        /* remove empty path components */
-       nElements = CFArrayGetCount(elements);
-       for (i = nElements; i > 0; i--) {
+       n = CFArrayGetCount(elements);
+       while (n-- > 0) {
                CFStringRef     pathElement;
 
-               pathElement = CFArrayGetValueAtIndex(elements, i - 1);
+               pathElement = CFArrayGetValueAtIndex(elements, n);
                if (CFStringGetLength(pathElement) == 0) {
-                       CFArrayRemoveValueAtIndex(elements, i - 1);
-                       nElements--;
+                       CFArrayRemoveValueAtIndex(elements, n);
                }
        }
 
@@ -75,7 +78,7 @@ static Boolean
 getPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef *entity)
 {
        CFStringRef             element;
-       CFArrayRef              elements;
+       CFMutableArrayRef       elements;
        CFIndex                 i;
        CFStringRef             link;
        CFIndex                 nElements;
@@ -97,7 +100,10 @@ getPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef *entity)
                SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
 
                __SCPreferencesAccess(prefs);
-               value = prefsPrivate->prefs;
+
+               *entity = prefsPrivate->prefs;
+               ok = TRUE;
+               goto done;
        }
 
        for (i = 0; i < nElements; i++) {
@@ -125,8 +131,7 @@ getPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef *entity)
                         * if not the last path component and this
                         * element is a link
                         */
-                       CFArrayRef              linkElements;
-                       CFMutableArrayRef       newElements;
+                       CFMutableArrayRef       linkElements;
 
                        if (++nLinks > MAXLINKS) {
                                /* if we are chasing our tail */
@@ -141,13 +146,11 @@ getPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef *entity)
                                goto done;
                        }
 
-                       newElements = CFArrayCreateMutableCopy(NULL, 0, linkElements);
-                       CFRelease(linkElements);
-                       CFArrayAppendArray(newElements,
+                       CFArrayAppendArray(linkElements,
                                           elements,
                                           CFRangeMake(i + 1, nElements-i - 1));
                        CFRelease(elements);
-                       elements = newElements;
+                       elements = linkElements;
 
                        goto restart;
                }
@@ -167,7 +170,7 @@ static Boolean
 setPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef entity)
 {
        CFStringRef             element;
-       CFArrayRef              elements;
+       CFMutableArrayRef       elements;
        CFIndex                 i;
        CFStringRef             link;
        CFIndex                 nElements;
@@ -251,8 +254,7 @@ setPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef entity)
                         * if not the last path component and this
                         * element is a link
                         */
-                       CFArrayRef              linkElements;
-                       CFMutableArrayRef       newElements;
+                       CFMutableArrayRef       linkElements;
 
                        if (++nLinks > MAXLINKS) {
                                /* if we are chasing our tail */
@@ -267,15 +269,14 @@ setPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef entity)
                                goto done;
                        }
 
-                       newElements = CFArrayCreateMutableCopy(NULL, 0, linkElements);
-                       CFRelease(linkElements);
-                       CFArrayAppendArray(newElements,
+                       CFArrayAppendArray(linkElements,
                                           elements,
                                           CFRangeMake(i + 1, nElements-i - 1));
                        CFRelease(elements);
-                       elements = newElements;
+                       elements = linkElements;
 
                        CFRelease(nodes);
+                       nodes = NULL;
                        goto restart;
                }
        }
@@ -524,7 +525,7 @@ Boolean
 SCPreferencesPathRemoveValue(SCPreferencesRef  prefs,
                             CFStringRef        path)
 {
-       CFArrayRef              elements        = NULL;
+       CFMutableArrayRef       elements        = NULL;
        Boolean                 ok              = FALSE;
        CFDictionaryRef         value;
 
index c2a3b583e91b267d0598fd8c15d97cd7ed509af9..fa2b1b52e82c11fa717ab94d7f3f58bbebcda26d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
 
+Boolean
+SCPreferencesRemoveAllValues(SCPreferencesRef prefs)
+{
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+
+       if (prefs == NULL) {
+               /* sorry, you must provide a session */
+               _SCErrorSet(kSCStatusNoPrefsSession);
+               return FALSE;
+       }
+
+       __SCPreferencesAccess(prefs);
+
+       CFDictionaryRemoveAllValues(prefsPrivate->prefs);
+       prefsPrivate->changed  = TRUE;
+       return TRUE;
+}
+
+
 Boolean
 SCPreferencesRemoveValue(SCPreferencesRef prefs, CFStringRef key)
 {
index 2419fb80daa0f68c46affd37609cd223d90287d6..4a87fa96f2dfdf503eacaf3c82b2b03ca300b4d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -46,14 +46,14 @@ __SCPreferencesUnlock_helper(SCPreferencesRef prefs)
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        uint32_t                status          = kSCStatusOK;
 
-       if (prefsPrivate->helper == -1) {
+       if (prefsPrivate->helper_port == MACH_PORT_NULL) {
                // if no helper
                goto fail;
        }
 
        // have the helper "unlock" the prefs
 //     status = kSCStatusOK;
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           SCHELPER_MSG_PREFS_UNLOCK,
                           NULL,
                           &status,
@@ -72,9 +72,8 @@ __SCPreferencesUnlock_helper(SCPreferencesRef prefs)
     fail :
 
        // close helper
-       if (prefsPrivate->helper != -1) {
-               _SCHelperClose(prefsPrivate->helper);
-               prefsPrivate->helper = -1;
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
        status = kSCStatusAccessError;
@@ -142,6 +141,11 @@ SCPreferencesUnlock(SCPreferencesRef prefs)
 
        pthread_mutex_lock(&prefsPrivate->lock);
 
+       if (prefsPrivate->sessionKeyLock != NULL) {
+               SCDynamicStoreRemoveValue(prefsPrivate->session,
+                                         prefsPrivate->sessionKeyLock);
+       }
+
        if (prefsPrivate->lockFD != -1) {
                if (prefsPrivate->lockPath != NULL) {
                        unlink(prefsPrivate->lockPath);
index f05a427e33e0a02bfb4088c378dbfdff9232a4df..b31ba81ef22e28f3b7ee9972eb3076a7ac4afb38 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2004, 2005, 2007-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2007-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -30,9 +30,7 @@
 #include <Availability.h>
 #include <TargetConditionals.h>
 #include <sys/cdefs.h>
-#if    !TARGET_OS_IPHONE
 #include <dispatch/dispatch.h>
-#endif // !TARGET_OS_IPHONE
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDynamicStore.h>
 
@@ -85,12 +83,10 @@ 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
+       kSCPreferencesNotificationCommit        = 1<<0, // __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)
+       kSCPreferencesNotificationApply         = 1<<1  // __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)
 };
-#endif (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
 
 typedef        uint32_t        SCPreferencesNotification;
 
@@ -437,7 +433,6 @@ SCPreferencesUnscheduleFromRunLoop  (
                                        CFStringRef             runLoopMode
                                        )                       __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
@@ -451,8 +446,7 @@ Boolean
 SCPreferencesSetDispatchQueue          (
                                         SCPreferencesRef       prefs,
                                         dispatch_queue_t       queue
-                                        )                      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
-#endif // !TARGET_OS_IPHONE
+                                        )                      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0/*SPI*/);
 
 /*!
        @function SCPreferencesSynchronize
index b86c07b97877efca0427757450ccc1a577380e7f..7d62507f0a565ec8287ffb0bdbf2ffeebcfdc4f4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2007-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -31,9 +31,7 @@
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SCPreferences.h>
 #include <SystemConfiguration/SCDynamicStore.h>
-#if    !TARGET_OS_IPHONE
 #include <dispatch/dispatch.h>
-#endif // !TARGET_OS_IPHONE
 
 
 #define        PREFS_DEFAULT_DIR               CFSTR("/Library/Preferences/SystemConfiguration")
@@ -60,6 +58,9 @@ typedef struct {
        /* preferences ID */
        CFStringRef             prefsID;
 
+       /* options */
+       CFDictionaryRef         options;
+
        /* configuration file */
        char                    *path;
        char                    *newPath;
@@ -77,6 +78,7 @@ typedef struct {
        SCDynamicStoreRef       session;
 
        /* configd session keys */
+       CFStringRef             sessionKeyLock;
        CFStringRef             sessionKeyCommit;
        CFStringRef             sessionKeyApply;
 
@@ -86,9 +88,7 @@ typedef struct {
        SCPreferencesCallBack   rlsFunction;
        SCPreferencesContext    rlsContext;
        CFMutableArrayRef       rlList;
-#if    !TARGET_OS_IPHONE
        dispatch_queue_t        dispatchQueue;          // SCPreferencesSetDispatchQueue
-#endif // !TARGET_OS_IPHONE
 
        /* preferences */
        CFMutableDictionaryRef  prefs;
@@ -100,7 +100,7 @@ typedef struct {
 
        /* authorization, helper */
        CFDataRef               authorizationData;
-       int                     helper;
+       mach_port_t             helper_port;
 
 } SCPreferencesPrivate, *SCPreferencesPrivateRef;
 
index c154f8d18ead657c05dacddc4eb41ecc312890db..30029daaf91250b40cb55294b3ee552b7fd62582 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006, 2007, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -92,6 +92,7 @@ copyMyExecutablePath(void)
 #pragma mark Keychain helper APIs
 
 
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
 /*
  * Create a SecAccessRef with a custom form.
  *
@@ -182,6 +183,7 @@ _SCSecAccessCreateForUID(uid_t uid)
 
        return access;
 }
+#endif // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
 
 
 // one example would be to pass a URL for "/System/Library/CoreServices/SystemUIServer.app"
@@ -236,29 +238,6 @@ _SCSecAccessCreateForExecutables(CFStringRef       label,
                goto done;
        }
 
-#ifdef NOT_NEEDED
-       // get the access control list for decryption operations (this controls access to an item's data)
-       status = SecAccessCopySelectedACLList(access, CSSM_ACL_AUTHORIZATION_DECRYPT, &aclList);
-       if (status == noErr) {
-               SecACLRef                               acl;
-               CFArrayRef                              applicationList = NULL;
-               CFStringRef                             description     = NULL;
-               CSSM_ACL_KEYCHAIN_PROMPT_SELECTOR       promptSelector;
-
-               // get the first entry in the access control list
-               acl = (SecACLRef)CFArrayGetValueAtIndex(aclList, 0);
-
-               // get the description and prompt selector
-               status = SecACLCopySimpleContents(acl, &applicationList, &description, &promptSelector);
-
-               // modify the application list
-               status = SecACLSetSimpleContents(acl, (CFArrayRef)trustedApplications, description, &promptSelector);
-
-               if (applicationList != NULL)    CFRelease(applicationList);
-               if (description != NULL)        CFRelease(description);
-       }
-#endif // NOT_NEEDED
-
     done :
 
        if (aclList != NULL)    CFRelease(aclList);
@@ -315,29 +294,28 @@ _SCSecKeychainCopySystemKeychain(void)
 #if    !TARGET_OS_IPHONE
 static OSStatus
 findKeychainItem(SecKeychainRef                keychain,
-                UInt32                 serviceNameLength,
-                void                   *serviceName,
+                CFStringRef            unique_id,
                 SecKeychainItemRef     *item)
 {
-       SecKeychainAttribute            attributes[1];
-       SecKeychainAttributeList        attributeList   = { 1, attributes };
-       SecKeychainSearchRef            search          = NULL;
-       OSStatus                        status;
+       CFMutableDictionaryRef  query;
+       OSStatus                status;
 
-       attributes[0].tag    = kSecServiceItemAttr;
-       attributes[0].data   = serviceName;
-       attributes[0].length = serviceNameLength;
+       query = CFDictionaryCreateMutable(NULL,
+                                         0,
+                                         &kCFTypeDictionaryKeyCallBacks,
+                                         &kCFTypeDictionaryValueCallBacks);
+       if (keychain != NULL) {
+               CFArrayRef      keychains;
 
-       status = SecKeychainSearchCreateFromAttributes(keychain,
-                                                      kSecGenericPasswordItemClass,
-                                                      &attributeList,
-                                                      &search);
-       if (status != noErr) {
-               return status;
+               keychains = CFArrayCreate(NULL, (const void **)&keychain, 1, &kCFTypeArrayCallBacks);
+               CFDictionarySetValue(query, kSecMatchSearchList, keychains);
+               CFRelease(keychains);
        }
-
-       status = SecKeychainSearchCopyNext(search, item);
-       CFRelease(search);
+       CFDictionarySetValue(query, kSecClass      , kSecClassGenericPassword);
+       CFDictionarySetValue(query, kSecAttrService, unique_id);
+       CFDictionarySetValue(query, kSecReturnRef  , kCFBooleanTrue);
+       status = SecItemCopyMatching(query, (CFTypeRef *)item);
+       CFRelease(query);
 
        return status;
 }
@@ -351,15 +329,9 @@ _SCSecKeychainPasswordItemCopy(SecKeychainRef      keychain,
 #if    !TARGET_OS_IPHONE
        SecKeychainItemRef      item                    = NULL;
        CFDataRef               keychain_password       = NULL;
-       const char              *keychain_serviceName;
        OSStatus                status;
 
-       keychain_serviceName = _SC_cfstring_to_cstring(unique_id, NULL, 0, kCFStringEncodingUTF8);
-       status = findKeychainItem(keychain,
-                                 strlen(keychain_serviceName),
-                                 (void *)keychain_serviceName,
-                                 &item);
-       CFAllocatorDeallocate(NULL, (void *)keychain_serviceName);
+       status = findKeychainItem(keychain, unique_id, &item);
        if (status == noErr) {
                void *          pw      = NULL;
                UInt32          pw_len  = 0;
@@ -388,15 +360,9 @@ _SCSecKeychainPasswordItemExists(SecKeychainRef keychain, CFStringRef unique_id)
 {
 #if    !TARGET_OS_IPHONE
        SecKeychainItemRef      item;
-       const char              *keychain_serviceName;
        OSStatus                status;
 
-       keychain_serviceName = _SC_cfstring_to_cstring(unique_id, NULL, 0, kCFStringEncodingUTF8);
-       status = findKeychainItem(keychain,
-                                 strlen(keychain_serviceName),
-                                 (void *)keychain_serviceName,
-                                 &item);
-       CFAllocatorDeallocate(NULL, (void *)keychain_serviceName);
+       status = findKeychainItem(keychain, unique_id, &item);
        if (status != noErr) {
                _SCErrorSet(status);
                return FALSE;
@@ -416,15 +382,9 @@ _SCSecKeychainPasswordItemRemove(SecKeychainRef keychain, CFStringRef unique_id)
 {
 #if    !TARGET_OS_IPHONE
        SecKeychainItemRef      item;
-       const char              *keychain_serviceName;
        OSStatus                status;
 
-       keychain_serviceName = _SC_cfstring_to_cstring(unique_id, NULL, 0, kCFStringEncodingUTF8);
-       status = findKeychainItem(keychain,
-                                 strlen(keychain_serviceName),
-                                 (void *)keychain_serviceName,
-                                 &item);
-       CFAllocatorDeallocate(NULL, (void *)keychain_serviceName);
+       status = findKeychainItem(keychain, unique_id, &item);
        if (status != noErr) {
                _SCErrorSet(status);
                return FALSE;
@@ -488,10 +448,27 @@ _SCSecKeychainPasswordItemSet(SecKeychainRef      keychain,
        }
 
        if ((allowRoot != NULL) && CFBooleanGetValue(allowRoot)) {
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
                access = _SCSecAccessCreateForUID(0);
                if (access == NULL) {
                        return FALSE;
                }
+#else  // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
+               CFErrorRef      error   = NULL;
+
+               access = SecAccessCreateWithOwnerAndACL(0, 0, kSecUseOnlyUID, NULL, &error);
+               if (access == NULL) {
+                       CFIndex code    = kSCStatusAccessError;
+
+                       if (error != NULL) {
+
+                               code = CFErrorGetCode(error);
+                               CFRelease(error);
+                       }
+                       _SCErrorSet(code);
+                       return FALSE;
+               }
+#endif // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
        } else if (allowedExecutables != NULL) {
                access = _SCSecAccessCreateForExecutables(label, allowedExecutables);
                if (access == NULL) {
@@ -532,10 +509,7 @@ _SCSecKeychainPasswordItemSet(SecKeychainRef       keychain,
                n++;
        }
 
-       status = findKeychainItem(keychain,
-                                 attributes[0].length,
-                                 attributes[0].data,
-                                 &item);
+       status = findKeychainItem(keychain, unique_id, &item);
        switch (status) {
                case noErr : {
                        const void      *pw     = NULL;
@@ -623,7 +597,7 @@ __SCPreferencesSystemKeychainPasswordItemCopy_helper(SCPreferencesRef       prefs,
        uint32_t                status          = kSCStatusOK;
        CFDataRef               reply           = NULL;
 
-       if (prefsPrivate->helper == -1) {
+       if (prefsPrivate->helper_port == MACH_PORT_NULL) {
                ok = __SCPreferencesCreate_helper(prefs);
                if (!ok) {
                        return FALSE;
@@ -636,7 +610,7 @@ __SCPreferencesSystemKeychainPasswordItemCopy_helper(SCPreferencesRef       prefs,
        }
 
        // have the helper set the "System" Keychain password
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           SCHELPER_MSG_KEYCHAIN_COPY,
                           data,
                           &status,
@@ -655,9 +629,8 @@ __SCPreferencesSystemKeychainPasswordItemCopy_helper(SCPreferencesRef       prefs,
     fail :
 
        // close helper
-       if (prefsPrivate->helper != -1) {
-               _SCHelperClose(prefsPrivate->helper);
-               prefsPrivate->helper = -1;
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
        status = kSCStatusAccessError;
@@ -769,7 +742,7 @@ __SCPreferencesSystemKeychainPasswordItemRemove_helper(SCPreferencesRef     prefs,
        uint32_t                status          = kSCStatusOK;
        CFDataRef               reply           = NULL;
 
-       if (prefsPrivate->helper == -1) {
+       if (prefsPrivate->helper_port == MACH_PORT_NULL) {
                ok = __SCPreferencesCreate_helper(prefs);
                if (!ok) {
                        return FALSE;
@@ -782,7 +755,7 @@ __SCPreferencesSystemKeychainPasswordItemRemove_helper(SCPreferencesRef     prefs,
        }
 
        // have the helper set the "System" Keychain password
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           SCHELPER_MSG_KEYCHAIN_REMOVE,
                           data,
                           &status,
@@ -801,9 +774,8 @@ __SCPreferencesSystemKeychainPasswordItemRemove_helper(SCPreferencesRef     prefs,
     fail :
 
        // close helper
-       if (prefsPrivate->helper != -1) {
-               _SCHelperClose(prefsPrivate->helper);
-               prefsPrivate->helper = -1;
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
        status = kSCStatusAccessError;
@@ -878,7 +850,7 @@ __SCPreferencesSystemKeychainPasswordItemSet_helper(SCPreferencesRef        prefs,
        uint32_t                status          = kSCStatusOK;
        CFDataRef               reply           = NULL;
 
-       if (prefsPrivate->helper == -1) {
+       if (prefsPrivate->helper_port == MACH_PORT_NULL) {
                ok = __SCPreferencesCreate_helper(prefs);
                if (!ok) {
                        return FALSE;
@@ -964,7 +936,7 @@ __SCPreferencesSystemKeychainPasswordItemSet_helper(SCPreferencesRef        prefs,
        }
 
        // have the helper create the "System" Keychain password
-       ok = _SCHelperExec(prefsPrivate->helper,
+       ok = _SCHelperExec(prefsPrivate->helper_port,
                           SCHELPER_MSG_KEYCHAIN_SET,
                           data,
                           &status,
@@ -983,9 +955,8 @@ __SCPreferencesSystemKeychainPasswordItemSet_helper(SCPreferencesRef        prefs,
     fail :
 
        // close helper
-       if (prefsPrivate->helper != -1) {
-               _SCHelperClose(prefsPrivate->helper);
-               prefsPrivate->helper = -1;
+       if (prefsPrivate->helper_port != MACH_PORT_NULL) {
+               _SCHelperClose(&prefsPrivate->helper_port);
        }
 
        status = kSCStatusAccessError;
index d3a738a3c8785ec79e441fc982e99dab4d5a0ffe..26676014a9641e7ec3fdfa668657a82acaa8719f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001, 2004, 2005, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -37,12 +37,17 @@ SCPreferencesPathKeyCreate(CFAllocatorRef   allocator,
                           CFStringRef          fmt,
                           ...)
 {
-       va_list args;
+       va_list         args;
+       CFStringRef     result;
+
        va_start(args, fmt);
-       return (CFStringCreateWithFormatAndArguments(allocator,
-                                                    NULL,
-                                                    fmt,
-                                                    args));
+       result = CFStringCreateWithFormatAndArguments(allocator,
+                                                     NULL,
+                                                     fmt,
+                                                     args);
+       va_end(args);
+
+       return result;
 }
 
 
index 7ed9bc618732e034eb4985d42cb56098649b9d4b..95f18f9b780f52294d2e05e22dfc2e85a6a7881d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2007-2009, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -35,6 +35,8 @@
        @header SCPreferencesPrivate
  */
 
+#define kSCPreferencesOptionRemoveWhenEmpty    CFSTR("remove-when-empty")      // CFBooleanRef
+
 /*!
        @enum SCPreferencesKeyType
        @discussion Used with the SCDynamicStoreKeyCreatePreferences() function
@@ -45,6 +47,7 @@
                to be applied to the active system configuration.
  */
 enum {
+       kSCPreferencesKeyLock   = 1,
        kSCPreferencesKeyCommit = 2,
        kSCPreferencesKeyApply  = 3
 };
@@ -72,6 +75,54 @@ SCDynamicStoreKeyCreatePreferences   (
                                        SCPreferencesKeyType    keyType
                                        )       __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_2_0,__IPHONE_2_0);
 
+/*!
+       @function SCPreferencesCreateWithOptions
+       @discussion Initiates access to the per-system set of configuration
+               preferences.
+       @param allocator The CFAllocator that should be used to allocate
+               memory for this preferences session.
+               This parameter may be NULL in which case the current
+               default CFAllocator is used.
+               If this reference is not a valid CFAllocator, the behavior
+               is undefined.
+       @param name A string that describes the name of the calling
+               process.
+       @param prefsID A string that identifies the name of the
+               group of preferences to be accessed or updated.
+       @param authorization An authorization reference that is used to
+               authorize any access to the enhanced privileges needed
+               to manage the preferences session.
+       @param options A CFDictionary with options that affect the
+               configuration preferences and how the APIs interact
+               with the plist.
+       @result Returns a reference to the new SCPreferences.
+               You must release the returned value.
+ */
+SCPreferencesRef
+SCPreferencesCreateWithOptions         (
+                                        CFAllocatorRef         allocator,
+                                        CFStringRef            name,
+                                        CFStringRef            prefsID,
+                                        AuthorizationRef       authorization,
+                                        CFDictionaryRef        options
+                                        )                      __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
+
+/*!
+       @function SCPreferencesRemoveAllValues
+       @discussion Removes all data associated with the preferences.
+
+       This function removes all data associated with the preferences.
+       To commit these changes to permanent storage a call must be made
+       to the SCPreferencesCommitChanges function.
+       @param prefs The preferences session.
+       @result Returns TRUE if the value was removed;
+               FALSE if the key did not exist or if an error occurred.
+ */
+Boolean
+SCPreferencesRemoveAllValues           (
+                                        SCPreferencesRef       prefs
+                                        )                      __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
+
 __END_DECLS
 
 #endif /* _SCPREFERENCESPRIVATE_H */
index 940c04aa69e637d29e8eecd9cbd1895f3b4c36cb..b044efbef8efb67e66aeb90b70b3715859e1c828 100644 (file)
@@ -73,7 +73,7 @@ SCPreferencesSetComputerName          (
 
                Note: To commit these changes to permanent storage you must
                call the SCPreferencesCommitChanges function.
-               In addition, you must call theSCPreferencesApplyChanges
+               In addition, you must call the SCPreferencesApplyChanges
                function for the new name to become active.
        @param prefs The preferences session.
        @param name The local host name to be set.
index 4fa55e934f3239d5eaf34944939f1b6ad9bbe330..ba073c4182caab8680a91198e5efe118265491c6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -26,6 +26,7 @@
 
 #include <sys/cdefs.h>
 #include <sys/socket.h>
+#include <sys/stat.h>
 #include <asl.h>
 #include <sys/syslog.h>
 #include <mach/message.h>
@@ -78,7 +79,21 @@ extern int   _sc_log;        /* 0 if SC messages should be written to stdout/stderr,
                value is either a valid host name or a numeric host address string
                consisting of a dotted decimal IPv4 address or an IPv6 address.
  */
-#define kSCNetworkReachabilityOptionNodeName   CFSTR("nodename")
+#define kSCNetworkReachabilityOptionNodeName                   CFSTR("nodename")
+
+/*!
+       @constant kSCNetworkReachabilityOptionLocalAddress
+       @discussion A CFData wrapping a "struct sockaddr" that represents
+               local address associated with a network connection.
+ */
+#define kSCNetworkReachabilityOptionLocalAddress               CFSTR("local-address")
+
+/*!
+       @constant kSCNetworkReachabilityOptionRemoteAddress
+       @discussion A CFData wrapping a "struct sockaddr" that represents
+               remote address associated with a network connection.
+ */
+#define kSCNetworkReachabilityOptionRemoteAddress              CFSTR("remote-address")
 
 /*!
        @constant kSCNetworkReachabilityOptionServName
@@ -86,7 +101,7 @@ extern int   _sc_log;        /* 0 if SC messages should be written to stdout/stderr,
                value is either a decimal port number or a service name listed in
                services(5).
  */
-#define kSCNetworkReachabilityOptionServName   CFSTR("servname")
+#define kSCNetworkReachabilityOptionServName                   CFSTR("servname")
 
 /*!
        @constant kSCNetworkReachabilityOptionHints
@@ -95,7 +110,15 @@ extern int  _sc_log;        /* 0 if SC messages should be written to stdout/stderr,
                ai_socktype, ai_protocol, and ai_flags structure elements.  All
                other elements must be 0 or the null pointer.
  */
-#define kSCNetworkReachabilityOptionHints      CFSTR("hints")
+#define kSCNetworkReachabilityOptionHints                      CFSTR("hints")
+
+/*!
+       @constant kSCNetworkReachabilityOptionInterface
+       @discussion A CFString specifying that the reachability query should be
+               limited to the provided network interface (e.g. "en0", "en1", ...).
+ */
+#define kSCNetworkReachabilityOptionInterface                  CFSTR("interface")
+
 
 /*!
        @constant kSCNetworkReachabilityOptionConnectionOnDemandByPass
@@ -110,6 +133,11 @@ extern int _sc_log;        /* 0 if SC messages should be written to stdout/stderr,
 
 __BEGIN_DECLS
 
+
+#pragma mark -
+#pragma mark SCError()
+
+
 /*!
        @function _SCErrorSet
        @discussion Sets the last SystemConfiguration.framework API error code.
@@ -117,6 +145,11 @@ __BEGIN_DECLS
  */
 void           _SCErrorSet                     (int                    error);
 
+
+#pragma mark -
+#pragma mark Serialization/Unserialization
+
+
 /*!
        @function _SCSerialize
        @discussion Serialize a CFPropertyList object for passing
@@ -229,6 +262,11 @@ CFDictionaryRef    _SCSerializeMultiple            (CFDictionaryRef        dict);
  */
 CFDictionaryRef        _SCUnserializeMultiple          (CFDictionaryRef        dict);
 
+
+#pragma mark -
+#pragma mark String conversion
+
+
 /*!
        @function _SC_cfstring_to_cstring
        @discussion Extracts a C-string from a CFString.
@@ -259,6 +297,20 @@ void               _SC_sockaddr_to_string          (const struct sockaddr  *address,
                                                 char                   *buf,
                                                 size_t                 bufLen);
 
+
+/*!
+ *     @function _SC_trimDomain
+ *     @discussion Trims leading and trailing "."s from a domain or host name
+ *     @param domain The domain name to trim
+ *     @result The trimmed domain name.
+ */
+CFStringRef    _SC_trimDomain                  (CFStringRef            domain);
+
+
+#pragma mark -
+#pragma mark Mach IPC
+
+
 /*!
        @function _SC_sendMachMessage
        @discussion Sends a trivial mach message (one with just a
@@ -270,6 +322,10 @@ void               _SC_sendMachMessage             (mach_port_t            port,
                                                 mach_msg_id_t          msg_id);
 
 
+#pragma mark -
+#pragma mark Logging
+
+
 /*!
        @function _SCCopyDescription
        @discussion Returns a formatted textual description of a CF object.
@@ -346,6 +402,35 @@ void               SCTrace                         (Boolean                condition,
                                                 CFStringRef            formatString,
                                                 ...);
 
+#pragma mark -
+#pragma mark Proxies
+
+
+/*!
+       @function SCNetworkProxiesCopyMatching
+       @discussion
+       @param globalConfiguration the proxy dictionary currently returned
+               by SCDynamicStoreCopyProxies().
+       @param server A CFString specying the hostname of interest; NULL if
+               no specific hostname should be used in selecting the proxy
+               configurations.
+       @param interface A CFString specifying that the proxy configuration
+               for the provided network interface (e.g. "en0", "en1", ...)
+               should be returned; NULL if proxy usage will not be scoped
+               to an interface.
+       @result A CFArray containing the proxy configurations associated
+               with the requested server and/or network interface.
+
+ */
+CFArrayRef
+SCNetworkProxiesCopyMatching                   (CFDictionaryRef        globalConfiguration,
+                                                CFStringRef            server,
+                                                CFStringRef            interface)      __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
+
+#pragma mark -
+#pragma mark Reachability
+
+
 /*!
        @function SCNetworkReachabilityCopyOnDemandService
        @discussion For target hosts that require an OnDemand connection, returns
@@ -397,6 +482,10 @@ _SC_checkResolverReachabilityByAddress             (SCDynamicStoreRef              *storeP,
                                                 Boolean                        *haveDNS,
                                                 struct sockaddr                *sa);
 
+#pragma mark -
+#pragma mark NetBIOS
+
+
 #if    !TARGET_OS_IPHONE
 /*
  * DOS encoding/codepage
@@ -408,6 +497,10 @@ _SC_dos_encoding_and_codepage                      (CFStringEncoding       macEncoding,
                                                 UInt32                 *dosCodepage);
 #endif // !TARGET_OS_IPHONE
 
+#pragma mark -
+#pragma mark ScheduleWithRunLoop/UnscheduleFromRunLoop
+
+
 /*
  * object / CFRunLoop  management
  */
@@ -435,6 +528,10 @@ _SC_unschedule                                     (CFTypeRef              obj,
                                                 CFMutableArrayRef      rlList,
                                                 Boolean                all);
 
+#pragma mark -
+#pragma mark Bundle
+
+
 /*
  * bundle access
  */
@@ -447,6 +544,19 @@ _SC_CFBundleCopyNonLocalizedString         (CFBundleRef            bundle,
                                                 CFStringRef            value,
                                                 CFStringRef            tableName);
 
+#pragma mark -
+#pragma mark Misc
+
+
+/*
+ * mach port access
+ */
+CFMachPortRef
+_SC_CFMachPortCreateWithPort                   (const char *           portDescription,
+                                                mach_port_t            portNum,
+                                                CFMachPortCallBack     callout,
+                                                CFMachPortContext      *context);
+
 /*
  * misc
  */
@@ -462,6 +572,22 @@ _SC_CFEqual(CFTypeRef val1, CFTypeRef val2)
        return FALSE;
 }
 
+static __inline__ Boolean
+_SC_isAppleInternal()
+{
+       static int isInternal   = 0;
+
+       if (isInternal == 0) {
+               int             ret;
+               struct stat     statbuf;
+
+               ret = stat("/AppleInternal", &statbuf);
+               isInternal = (ret == 0) ? 1 : 2;
+       }
+
+       return (isInternal == 1);
+}
+
 /*
  * debugging
  */
@@ -485,6 +611,11 @@ _SC_logMachPortReferences                  (const char             *str,
 CFStringRef
 _SC_copyBacktrace                              (void);
 
+void
+_SC_crash                                      (const char             *crash_info,
+                                                CFStringRef            notifyHeader,
+                                                CFStringRef            notifyMessage);
+
 __END_DECLS
 
 #endif /* _SCPRIVATE_H */
index 8cfc5ffdf799084405fb1e797416ae2587bbdcbd..68fa5e0e8eb1c64aae35866da87089a1296189fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004, 2006-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -28,6 +28,7 @@
  * - initial revision
  */
 
+#include <TargetConditionals.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
@@ -204,12 +205,24 @@ SCDynamicStoreCopyProxies(SCDynamicStoreRef store)
                               kSCPropNetProxiesSOCKSPort,
                               "socks",
                               1080);
-       validate_proxy_content(newProxies,
-                              kSCPropNetProxiesProxyAutoConfigEnable,
-                              kSCPropNetProxiesProxyAutoConfigURLString,
-                              NULL,
-                              NULL,
-                              0);
+       if (CFDictionaryContainsKey(newProxies, kSCPropNetProxiesProxyAutoConfigURLString)) {
+               validate_proxy_content(newProxies,
+                                      kSCPropNetProxiesProxyAutoConfigEnable,
+                                      kSCPropNetProxiesProxyAutoConfigURLString,
+                                      NULL,
+                                      NULL,
+                                      0);
+
+               // and we can't have both URLString and JavaScript keys
+               CFDictionaryRemoveValue(newProxies, kSCPropNetProxiesProxyAutoConfigJavaScript);
+       } else {
+               validate_proxy_content(newProxies,
+                                      kSCPropNetProxiesProxyAutoConfigEnable,
+                                      kSCPropNetProxiesProxyAutoConfigJavaScript,
+                                      NULL,
+                                      NULL,
+                                      0);
+       }
        validate_proxy_content(newProxies,
                               kSCPropNetProxiesProxyAutoDiscoveryEnable,
                               NULL,
@@ -281,3 +294,176 @@ SCDynamicStoreCopyProxies(SCDynamicStoreRef store)
        if (tempSession)        CFRelease(store);
        return proxies;
 }
+
+
+CFArrayRef
+SCNetworkProxiesCopyMatching(CFDictionaryRef   globalConfiguration,
+                            CFStringRef        server,
+                            CFStringRef        interface)
+{
+       CFMutableDictionaryRef  newProxy;
+       CFArrayRef              proxies         = NULL;
+       CFDictionaryRef         proxy;
+       int                     sc_status       = kSCStatusOK;
+       CFStringRef             trimmed         = NULL;
+
+       if (!isA_CFDictionary(globalConfiguration)) {
+               // if no proxy configuration
+               _SCErrorSet(kSCStatusOK);
+               return NULL;
+       }
+
+       if (interface != NULL) {
+               CFDictionaryRef         scoped;
+
+               if (!isA_CFString(interface) ||
+                   (CFStringGetLength(interface) == 0)) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+
+               scoped = CFDictionaryGetValue(globalConfiguration, kSCPropNetProxiesScoped);
+               if (scoped == NULL) {
+                       // if no scoped proxy configurations
+                       _SCErrorSet(kSCStatusOK);
+                       return NULL;
+               }
+
+               if (!isA_CFDictionary(scoped)) {
+                       // if corrupt proxy configuration
+                       _SCErrorSet(kSCStatusFailed);
+                       return NULL;
+               }
+
+               proxy = CFDictionaryGetValue(scoped, interface);
+               if (proxy == NULL) {
+                       // if no scoped proxy configuration for this interface
+                       _SCErrorSet(kSCStatusOK);
+                       return NULL;
+               }
+
+               if (!isA_CFDictionary(proxy)) {
+                       // if corrupt proxy configuration
+                       _SCErrorSet(kSCStatusFailed);
+                       return NULL;
+               }
+
+               // return per-interface proxy configuration
+               proxies = CFArrayCreate(NULL, (const void **)&proxy, 1, &kCFTypeArrayCallBacks);
+               return proxies;
+       }
+
+       if (server != NULL) {
+               CFIndex                 i;
+               CFMutableArrayRef       matching        = NULL;
+               CFIndex                 n;
+               CFIndex                 server_len;
+               CFArrayRef              supplemental;
+
+               trimmed = _SC_trimDomain(server);
+               if (trimmed == NULL) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return NULL;
+               }
+
+               server = trimmed;
+               server_len = CFStringGetLength(server);
+
+               supplemental = CFDictionaryGetValue(globalConfiguration, kSCPropNetProxiesSupplemental);
+               if (supplemental == NULL) {
+                       // if no supplemental configurations
+                       goto done;
+               }
+
+               if (!isA_CFArray(supplemental)) {
+                       // if corrupt proxy configuration
+                       sc_status = kSCStatusFailed;
+                       goto done;
+               }
+
+               n = CFArrayGetCount(supplemental);
+               for (i = 0; i < n; i++) {
+                       CFStringRef     domain;
+                       CFIndex         domain_len;
+                       CFIndex         n_matching;
+
+                       proxy = CFArrayGetValueAtIndex(supplemental, i);
+                       if (!isA_CFDictionary(proxy)) {
+                               // if corrupt proxy configuration
+                               continue;
+                       }
+
+                       domain = CFDictionaryGetValue(proxy, kSCPropNetProxiesSupplementalMatchDomain);
+                       if (!isA_CFString(domain)) {
+                               // if corrupt proxy configuration
+                               continue;
+                       }
+
+                       domain_len = CFStringGetLength(domain);
+                       if (domain_len > 0) {
+                               if (!CFStringFindWithOptions(server,
+                                                            domain,
+                                                            CFRangeMake(0, server_len),
+                                                            kCFCompareCaseInsensitive|kCFCompareAnchored|kCFCompareBackwards,
+                                                            NULL)) {
+                                       // if server does not match this proxy domain (or host)
+                                       continue;
+                               }
+
+                               if ((server_len > domain_len) &&
+                                   !CFStringFindWithOptions(server,
+                                                            CFSTR("."),
+                                                            CFRangeMake(0, server_len - domain_len),
+                                                            kCFCompareCaseInsensitive|kCFCompareAnchored|kCFCompareBackwards,
+                                                            NULL)) {
+                                       // if server does not match this proxy domain
+                                       continue;
+                               }
+//                     } else {
+//                             // if this is a "default" (match all) proxy domain
+                       }
+
+                       if (matching == NULL) {
+                               matching = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+                       }
+                       n_matching = CFArrayGetCount(matching);
+
+                       newProxy = CFDictionaryCreateMutableCopy(NULL, 0, proxy);
+                       CFDictionaryRemoveValue(newProxy, kSCPropNetProxiesSupplementalMatchDomain);
+                       if ((n_matching == 0) ||
+                           !CFArrayContainsValue(matching, CFRangeMake(0, n_matching), newProxy)) {
+                               // add this matching proxy
+                               CFArrayAppendValue(matching, newProxy);
+                       }
+                       CFRelease(newProxy);
+               }
+
+               if (matching != NULL) {
+                       // if we have any supplemental match domains
+                       proxies = CFArrayCreateCopy(NULL, matching);
+                       CFRelease(matching);
+                       goto done;
+               }
+       }
+
+       // no matches, return "global" proxy configuration
+
+       newProxy = CFDictionaryCreateMutableCopy(NULL, 0, globalConfiguration);
+       CFDictionaryRemoveValue(newProxy, kSCPropNetProxiesScoped);
+       CFDictionaryRemoveValue(newProxy, kSCPropNetProxiesSupplemental);
+       proxies = CFArrayCreate(NULL, (const void **)&newProxy, 1, &kCFTypeArrayCallBacks);
+       CFRelease(newProxy);
+
+    done :
+
+       if (sc_status != kSCStatusOK) {
+               if (proxies != NULL) {
+                       CFRelease(proxies);
+                       proxies = NULL;
+               }
+               _SCErrorSet(sc_status);
+       }
+       if (trimmed != NULL) CFRelease(trimmed);
+
+       return proxies;
+}
index ac8b474c32a21f10d7c8e1c2b5b98d2aa5bcf977..159a37d2d5b8d7a968c12a5fb8a0f22ad90798d2 100644 (file)
@@ -62,8 +62,10 @@ const CFStringRef kSCEntNet6to4                                    = CFSTR("6to4
 
 
 const CFStringRef kSCEntNetEAPOL                                   = CFSTR("EAPOL");
+const CFStringRef kSCEntNetLoopback                                = CFSTR("Loopback");
 const CFStringRef kSCEntNetOnDemand                                = CFSTR("OnDemand");
 const CFStringRef kSCEntNetService                                 = CFSTR("__SERVICE__");
+const CFStringRef kSCEntNetVPN                                     = CFSTR("VPN");
 const CFStringRef kSCPropNetOverridePrimary                        = CFSTR("OverridePrimary");
 const CFStringRef kSCPropNetServiceOrder                           = CFSTR("ServiceOrder");
 const CFStringRef kSCPropNetPPPOverridePrimary                     = CFSTR("PPPOverridePrimary");
@@ -114,6 +116,16 @@ const CFStringRef kSCPropNetDNSSupplementalMatchOrders             = CFSTR("Supp
 const CFStringRef kSCPropNetEthernetMediaSubType                   = CFSTR("MediaSubType");
 const CFStringRef kSCPropNetEthernetMediaOptions                   = CFSTR("MediaOptions");
 const CFStringRef kSCPropNetEthernetMTU                            = CFSTR("MTU");
+const CFStringRef kSCPropNetEthernetCapabilityAV                   = CFSTR("AV");
+const CFStringRef kSCPropNetEthernetCapabilityJUMBO_MTU            = CFSTR("JUMBO_MTU");
+const CFStringRef kSCPropNetEthernetCapabilityLRO                  = CFSTR("LRO");
+const CFStringRef kSCPropNetEthernetCapabilityRXCSUM               = CFSTR("RXCSUM");
+const CFStringRef kSCPropNetEthernetCapabilityTSO                  = CFSTR("TSO");
+const CFStringRef kSCPropNetEthernetCapabilityTSO4                 = CFSTR("TSO4");
+const CFStringRef kSCPropNetEthernetCapabilityTSO6                 = CFSTR("TSO6");
+const CFStringRef kSCPropNetEthernetCapabilityTXCSUM               = CFSTR("TXCSUM");
+const CFStringRef kSCPropNetEthernetCapabilityVLAN_HWTAGGING       = CFSTR("VLAN_HWTAGGING");
+const CFStringRef kSCPropNetEthernetCapabilityVLAN_MTU             = CFSTR("VLAN_MTU");
 const CFStringRef kSCPropNetInterfaceDeviceName                    = CFSTR("DeviceName");
 const CFStringRef kSCPropNetInterfaceHardware                      = CFSTR("Hardware");
 const CFStringRef kSCPropNetInterfaceType                          = CFSTR("Type");
@@ -128,6 +140,8 @@ const CFStringRef kSCValNetInterfaceSubTypePPPoE                   = CFSTR("PPPo
 const CFStringRef kSCValNetInterfaceSubTypePPPSerial               = CFSTR("PPPSerial");
 const CFStringRef kSCValNetInterfaceSubTypePPTP                    = CFSTR("PPTP");
 const CFStringRef kSCValNetInterfaceSubTypeL2TP                    = CFSTR("L2TP");
+const CFStringRef kSCValNetInterfaceTypeLoopback                   = CFSTR("Loopback");
+const CFStringRef kSCValNetInterfaceTypeVPN                        = CFSTR("VPN");
 const CFStringRef kSCPropNetIPSecAuthenticationMethod              = CFSTR("AuthenticationMethod");
 const CFStringRef kSCPropNetIPSecLocalCertificate                  = CFSTR("LocalCertificate");
 const CFStringRef kSCPropNetIPSecLocalIdentifier                   = CFSTR("LocalIdentifier");
@@ -167,7 +181,12 @@ const CFStringRef kSCValNetIPv4ConfigMethodINFORM                  = CFSTR("INFO
 const CFStringRef kSCValNetIPv4ConfigMethodLinkLocal               = CFSTR("LinkLocal");
 const CFStringRef kSCValNetIPv4ConfigMethodManual                  = CFSTR("Manual");
 const CFStringRef kSCValNetIPv4ConfigMethodPPP                     = CFSTR("PPP");
+const CFStringRef kSCPropNetIPv4ExcludedRoutes                     = CFSTR("ExcludedRoutes");
+const CFStringRef kSCPropNetIPv4IncludedRoutes                     = CFSTR("IncludedRoutes");
 const CFStringRef kSCValNetIPv4ConfigMethodFailover                = CFSTR("Failover");
+const CFStringRef kSCPropNetIPv4RouteDestinationAddress            = CFSTR("DestinationAddress");
+const CFStringRef kSCPropNetIPv4RouteSubnetMask                    = CFSTR("SubnetMask");
+const CFStringRef kSCPropNetIPv4RouteGatewayAddress                = CFSTR("GatewayAddress");
 const CFStringRef kSCPropNetIPv6Addresses                          = CFSTR("Addresses");
 const CFStringRef kSCPropNetIPv6ConfigMethod                       = CFSTR("ConfigMethod");
 const CFStringRef kSCPropNetIPv6DestAddresses                      = CFSTR("DestAddresses");
@@ -175,9 +194,15 @@ const CFStringRef kSCPropNetIPv6Flags                              = CFSTR("Flag
 const CFStringRef kSCPropNetIPv6PrefixLength                       = CFSTR("PrefixLength");
 const CFStringRef kSCPropNetIPv6Router                             = CFSTR("Router");
 const CFStringRef kSCValNetIPv6ConfigMethodAutomatic               = CFSTR("Automatic");
+const CFStringRef kSCValNetIPv6ConfigMethodLinkLocal               = CFSTR("LinkLocal");
 const CFStringRef kSCValNetIPv6ConfigMethodManual                  = CFSTR("Manual");
 const CFStringRef kSCValNetIPv6ConfigMethodRouterAdvertisement     = CFSTR("RouterAdvertisement");
 const CFStringRef kSCValNetIPv6ConfigMethod6to4                    = CFSTR("6to4");
+const CFStringRef kSCPropNetIPv6ExcludedRoutes                     = CFSTR("ExcludedRoutes");
+const CFStringRef kSCPropNetIPv6IncludedRoutes                     = CFSTR("IncludedRoutes");
+const CFStringRef kSCPropNetIPv6RouteDestinationAddress            = CFSTR("DestinationAddress");
+const CFStringRef kSCPropNetIPv6RoutePrefixLength                  = CFSTR("PrefixLength");
+const CFStringRef kSCPropNetIPv6RouteGatewayAddress                = CFSTR("GatewayAddress");
 const CFStringRef kSCPropNet6to4Relay                              = CFSTR("Relay");
 const CFStringRef kSCPropNetLinkActive                             = CFSTR("Active");
 const CFStringRef kSCPropNetLinkDetaching                          = CFSTR("Detaching");
@@ -276,6 +301,9 @@ const CFStringRef kSCPropNetPPPLCPTransmitACCM                     = CFSTR("LCPT
 const CFStringRef kSCPropNetPPPOnDemandDomains                     = CFSTR("OnDemandDomains");
 const CFStringRef kSCPropNetPPPOnDemandEnabled                     = CFSTR("OnDemandEnabled");
 const CFStringRef kSCPropNetPPPOnDemandHostName                    = CFSTR("OnDemandHostName");
+const CFStringRef kSCPropNetPPPOnDemandMatchDomainsAlways          = CFSTR("OnDemandMatchDomainsAlways");
+const CFStringRef kSCPropNetPPPOnDemandMatchDomainsOnRetry         = CFSTR("OnDemandMatchDomainsOnRetry");
+const CFStringRef kSCPropNetPPPOnDemandMatchDomainsNever           = CFSTR("OnDemandMatchDomainsNever");
 const CFStringRef kSCPropNetPPPOnDemandMode                        = CFSTR("OnDemandMode");
 const CFStringRef kSCPropNetPPPOnDemandPriority                    = CFSTR("OnDemandPriority");
 const CFStringRef kSCValNetPPPOnDemandModeAggressive               = CFSTR("Aggressive");
@@ -312,8 +340,14 @@ const CFStringRef kSCPropNetProxiesSOCKSEnable                     = CFSTR("SOCK
 const CFStringRef kSCPropNetProxiesSOCKSPort                       = CFSTR("SOCKSPort");
 const CFStringRef kSCPropNetProxiesSOCKSProxy                      = CFSTR("SOCKSProxy");
 const CFStringRef kSCPropNetProxiesProxyAutoConfigEnable           = CFSTR("ProxyAutoConfigEnable");
+const CFStringRef kSCPropNetProxiesProxyAutoConfigJavaScript       = CFSTR("ProxyAutoConfigJavaScript");
 const CFStringRef kSCPropNetProxiesProxyAutoConfigURLString        = CFSTR("ProxyAutoConfigURLString");
 const CFStringRef kSCPropNetProxiesProxyAutoDiscoveryEnable        = CFSTR("ProxyAutoDiscoveryEnable");
+const CFStringRef kSCPropNetProxiesSupplementalMatchDomains        = CFSTR("SupplementalMatchDomains");
+const CFStringRef kSCPropNetProxiesSupplementalMatchOrders         = CFSTR("SupplementalMatchOrders");
+const CFStringRef kSCPropNetProxiesScoped                          = CFSTR("__SCOPED__");
+const CFStringRef kSCPropNetProxiesSupplemental                    = CFSTR("__SUPPLEMENTAL__");
+const CFStringRef kSCPropNetProxiesSupplementalMatchDomain         = CFSTR("__MATCH_DOMAIN__");
 const CFStringRef kSCPropNetServicePrimaryRank                     = CFSTR("PrimaryRank");
 const CFStringRef kSCPropNetServiceUserDefinedName                 = CFSTR("UserDefinedName");
 const CFStringRef kSCValNetServicePrimaryRankFirst                 = CFSTR("First");
@@ -332,6 +366,30 @@ const CFStringRef kSCValNetSMBNetBIOSNodeTypeMixed                 = CFSTR("Mixe
 const CFStringRef kSCValNetSMBNetBIOSNodeTypeHybrid                = CFSTR("Hybrid");
 #endif // !TARGET_OS_IPHONE
 
+const CFStringRef kSCPropNetVPNAuthName                            = CFSTR("AuthName");
+const CFStringRef kSCPropNetVPNAuthPassword                        = CFSTR("AuthPassword");
+const CFStringRef kSCPropNetVPNAuthPasswordEncryption              = CFSTR("AuthPasswordEncryption");
+const CFStringRef kSCPropNetVPNAuthenticationMethod                = CFSTR("AuthenticationMethod");
+const CFStringRef kSCPropNetVPNConnectTime                         = CFSTR("ConnectTime");
+const CFStringRef kSCPropNetVPNDisconnectOnFastUserSwitch          = CFSTR("DisconnectOnFastUserSwitch");
+const CFStringRef kSCPropNetVPNDisconnectOnIdle                    = CFSTR("DisconnectOnIdle");
+const CFStringRef kSCPropNetVPNDisconnectOnIdleTimer               = CFSTR("DisconnectOnIdleTimer");
+const CFStringRef kSCPropNetVPNDisconnectOnLogout                  = CFSTR("DisconnectOnLogout");
+const CFStringRef kSCPropNetVPNDisconnectOnSleep                   = CFSTR("DisconnectOnSleep");
+const CFStringRef kSCPropNetVPNLocalCertificate                    = CFSTR("LocalCertificate");
+const CFStringRef kSCPropNetVPNLogfile                             = CFSTR("Logfile");
+const CFStringRef kSCPropNetVPNMTU                                 = CFSTR("MTU");
+const CFStringRef kSCPropNetVPNOnDemandEnabled                     = CFSTR("OnDemandEnabled");
+const CFStringRef kSCPropNetVPNOnDemandMatchDomainsAlways          = CFSTR("OnDemandMatchDomainsAlways");
+const CFStringRef kSCPropNetVPNOnDemandMatchDomainsOnRetry         = CFSTR("OnDemandMatchDomainsOnRetry");
+const CFStringRef kSCPropNetVPNOnDemandMatchDomainsNever           = CFSTR("OnDemandMatchDomainsNever");
+const CFStringRef kSCPropNetVPNRemoteAddress                       = CFSTR("RemoteAddress");
+const CFStringRef kSCPropNetVPNStatus                              = CFSTR("Status");
+const CFStringRef kSCPropNetVPNVerboseLogging                      = CFSTR("VerboseLogging");
+const CFStringRef kSCValNetVPNAuthenticationMethodPassword         = CFSTR("Password");
+const CFStringRef kSCValNetVPNAuthenticationMethodCertificate      = CFSTR("Certificate");
+const CFStringRef kSCValNetVPNAuthPasswordEncryptionKeychain       = CFSTR("Keychain");
+const CFStringRef kSCValNetVPNAuthPasswordEncryptionPrompt         = CFSTR("Prompt");
 
 #if !TARGET_OS_IPHONE
 const CFStringRef kSCEntUsersConsoleUser                           = CFSTR("ConsoleUser");
@@ -352,16 +410,14 @@ 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 kSCPropVirtualNetworkInterfacesBridgeInterfaces  = CFSTR("Interfaces");
+const CFStringRef kSCPropVirtualNetworkInterfacesBridgeOptions     = 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");
index 5089ecac039603202eb61969e7e21d8018206f96..22e2b0b40c96ed498118dd6da50b9b6617b383e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  *   --- kSCPropNetIPv6ConfigMethod values ---
  *   kSCValNetIPv6ConfigMethodAutomatic                 "Automatic"
+ *   kSCValNetIPv6ConfigMethodLinkLocal                 "LinkLocal"
  *   kSCValNetIPv6ConfigMethodManual                    "Manual"
  *   kSCValNetIPv6ConfigMethodRouterAdvertisement       "RouterAdvertisement"
  *   kSCValNetIPv6ConfigMethod6to4                      "6to4"
  *   kSCPropNetProxiesSOCKSPort                         "SOCKSPort"                    CFNumber
  *   kSCPropNetProxiesSOCKSProxy                        "SOCKSProxy"                   CFString
  *   kSCPropNetProxiesProxyAutoConfigEnable             "ProxyAutoConfigEnable"        CFNumber (0 or 1)
+ *   kSCPropNetProxiesProxyAutoConfigJavaScript         "ProxyAutoConfigJavaScript"    CFString
  *   kSCPropNetProxiesProxyAutoConfigURLString          "ProxyAutoConfigURLString"     CFString
  *   kSCPropNetProxiesProxyAutoDiscoveryEnable          "ProxyAutoDiscoveryEnable"     CFNumber (0 or 1)
  *
 #include <Availability.h>
 #include <TargetConditionals.h>
 
-/*
- * let's "do the right thing" for those wishing to build for
- * Mac OS X 10.1.0 ... 10.2.x
- */
-#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (__MAC_OS_X_VERSION_MIN_REQUIRED <= 1020) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
-  #ifndef SCSTR
-    #include <CoreFoundation/CFString.h>
-    #define SCSTR(s) CFSTR(s)
-  #endif
-  #ifndef SC_SCHEMA_DECLARATION
-    #define SC_SCHEMA_DECLARATION(k,q) extern const CFStringRef k q;
-  #endif
-  #ifndef SC_SCHEMA_KV
-    #define SC_SCHEMA_KV(k,v,t)        SCSTR( v )
-  #endif
-#endif
-
 /*
  * Define a schema key/value/type tuple
  */
     #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) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
-  #ifndef SCSTR
-    #include <CoreFoundation/CFString.h>
-    #define SCSTR(s) CFSTR(s)
-  #endif
-#endif
-
-
 /* -------------------- HeaderDoc comments -------------------- */
 
 
@@ -1417,6 +1394,12 @@ extern const CFStringRef kSCPropNetIPv6Router;
  */
 extern const CFStringRef kSCValNetIPv6ConfigMethodAutomatic;
 
+/*!
+  @const kSCValNetIPv6ConfigMethodLinkLocal
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCValNetIPv6ConfigMethodLinkLocal;
+
 /*!
   @const kSCValNetIPv6ConfigMethodManual
   @availability Introduced in Mac OS X 10.3.
@@ -2189,6 +2172,12 @@ extern const CFStringRef kSCPropNetProxiesSOCKSProxy;
  */
 extern const CFStringRef kSCPropNetProxiesProxyAutoConfigEnable;
 
+/*!
+  @const kSCPropNetProxiesProxyAutoConfigJavaScript
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetProxiesProxyAutoConfigJavaScript;
+
 /*!
   @const kSCPropNetProxiesProxyAutoConfigURLString
   @availability Introduced in Mac OS X 10.4.
@@ -2219,7 +2208,7 @@ extern const CFStringRef kSCPropNetSMBNetBIOSNodeType;
 
 /*!
   @const kSCPropNetSMBNetBIOSScope
-  @availability Introduced in Mac OS X 10.5.
+  @availability Introduced in Mac OS X 10.5, but later deprecated in Mac OS X 10.7.
  */
 extern const CFStringRef kSCPropNetSMBNetBIOSScope;
 
@@ -2388,2330 +2377,1768 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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 !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
 
 #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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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 !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
 
 #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
 
   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
 
   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
 
   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
 
   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 !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
 
 #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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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 !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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
 #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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
+
+  SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodLinkLocal, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCValNetIPv6ConfigMethodLinkLocal                            \
+         SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodLinkLocal               \
+                     ,"LinkLocal"                                      \
+                     ,                                                 )
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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 !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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
 #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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
+
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoConfigJavaScript, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetProxiesProxyAutoConfigJavaScript                    \
+         SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigJavaScript       \
+                     ,"ProxyAutoConfigJavaScript"                      \
+                     ,CFString                                         )
 
   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
 
   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 !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
 
   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
 
-  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*/
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSScope, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_7,__IPHONE_NA,__IPHONE_NA))
   #define kSCPropNetSMBNetBIOSScope                                     \
          SC_SCHEMA_KV(kSCPropNetSMBNetBIOSScope                        \
                      ,"NetBIOSScope"                                   \
                      ,CFString                                         )
-#endif
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
 #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
 
 #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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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 !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
 
   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
 
   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 // !TARGET_OS_IPHONE
 
index 6da974704c5b6a465e4c99f4e85ffd57064bb9e1..f7cebc1fb2430871d3dd00bb05d22e6fe8210d64 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  *   kSCEntNetCommCenter                                "com.apple.CommCenter"         CFDictionary
  *   kSCEntNetEAPOL                                     "EAPOL"                        CFDictionary
+ *   kSCEntNetLoopback                                  "Loopback"                     CFDictionary
  *   kSCEntNetOnDemand                                  "OnDemand"                     CFDictionary
  *   kSCEntNetService                                   "__SERVICE__"                  CFDictionary
+ *   kSCEntNetVPN                                       "VPN"                          CFDictionary
  *
  * kSCCompNetwork Properties
  *
  *   kSCPropNetCommCenterAllowNetworkAccess             "AllowNetworkAccess"           CFNumber (0 or 1)
  *   kSCPropNetCommCenterAvailable                      "Available"                    CFNumber (0 or 1)
  *
+ * kSCEntNetEthernet (Hardware) Entity Keys
+ *
+ *   kSCPropNetEthernetCapabilityAV                     "AV"                           CFNumber (0 or 1)
+ *   kSCPropNetEthernetCapabilityJUMBO_MTU              "JUMBO_MTU"                    CFNumber (0 or 1)
+ *   kSCPropNetEthernetCapabilityLRO                    "LRO"                          CFNumber (0 or 1)
+ *   kSCPropNetEthernetCapabilityRXCSUM                 "RXCSUM"                       CFNumber (0 or 1)
+ *   kSCPropNetEthernetCapabilityTSO                    "TSO"                          CFNumber (0 or 1)
+ *   kSCPropNetEthernetCapabilityTSO4                   "TSO4"                         CFNumber (0 or 1)
+ *   kSCPropNetEthernetCapabilityTSO6                   "TSO6"                         CFNumber (0 or 1)
+ *   kSCPropNetEthernetCapabilityTXCSUM                 "TXCSUM"                       CFNumber (0 or 1)
+ *   kSCPropNetEthernetCapabilityVLAN_HWTAGGING         "VLAN_HWTAGGING"               CFNumber (0 or 1)
+ *   kSCPropNetEthernetCapabilityVLAN_MTU               "VLAN_MTU"                     CFNumber (0 or 1)
+ *
+ * kSCEntNetInterface Entity Keys
+ *
+ *   --- kSCPropNetInterfaceType values ---
+ *   kSCValNetInterfaceTypeLoopback                     "Loopback"
+ *   kSCValNetInterfaceTypeVPN                          "VPN"
+ *
  * kSCEntNetIPSec Entity Keys
  *
  *   kSCPropNetIPSecLastCause                           "LastCause"                    CFNumber
  *
  * kSCEntNetIPv4 Entity Keys
  *
+ *   kSCPropNetIPv4ExcludedRoutes                       "ExcludedRoutes"               CFArray[CFDictionary]
+ *   kSCPropNetIPv4IncludedRoutes                       "IncludedRoutes"               CFArray[CFDictionary]
+ *
  *   --- kSCPropNetIPv4ConfigMethod values ---
  *   kSCValNetIPv4ConfigMethodFailover                  "Failover"
  *
+ *   --- kSCPropNetIPv4IncludedRoutes, kSCPropNetIPv4ExcludedRoutes [CFDictionary] keys ---
+ *   kSCPropNetIPv4RouteDestinationAddress              "DestinationAddress"           CFString
+ *   kSCPropNetIPv4RouteSubnetMask                      "SubnetMask"                   CFString
+ *   kSCPropNetIPv4RouteGatewayAddress                  "GatewayAddress"               CFString
+ *
+ * kSCEntNetIPv6 Entity Keys
+ *
+ *   kSCPropNetIPv6ExcludedRoutes                       "ExcludedRoutes"               CFArray[CFDictionary]
+ *   kSCPropNetIPv6IncludedRoutes                       "IncludedRoutes"               CFArray[CFDictionary]
+ *
+ *   --- kSCPropNetIPv6IncludedRoutes, kSCPropNetIPv6ExcludedRoutes [CFDictionary] keys ---
+ *   kSCPropNetIPv6RouteDestinationAddress              "DestinationAddress"           CFString
+ *   kSCPropNetIPv6RoutePrefixLength                    "PrefixLength"                 CFNumber
+ *   kSCPropNetIPv6RouteGatewayAddress                  "GatewayAddress"               CFString
+ *
  * kSCEntNetPPP Entity Keys
  *
  *   --- OnDemand: ---
  *   kSCPropNetPPPOnDemandDomains                       "OnDemandDomains"              CFArray[CFString]
  *   kSCPropNetPPPOnDemandEnabled                       "OnDemandEnabled"              CFNumber (0 or 1)
  *   kSCPropNetPPPOnDemandHostName                      "OnDemandHostName"             CFString
+ *   kSCPropNetPPPOnDemandMatchDomainsAlways            "OnDemandMatchDomainsAlways"   CFArray[CFString]
+ *   kSCPropNetPPPOnDemandMatchDomainsOnRetry           "OnDemandMatchDomainsOnRetry"  CFArray[CFString]
+ *   kSCPropNetPPPOnDemandMatchDomainsNever             "OnDemandMatchDomainsNever"    CFArray[CFString]
  *   kSCPropNetPPPOnDemandMode                          "OnDemandMode"                 CFString
  *   kSCPropNetPPPOnDemandPriority                      "OnDemandPriority"             CFString
  *
  *   kSCValNetPPPOnDemandPriorityHigh                   "High"
  *   kSCValNetPPPOnDemandPriorityLow                    "Low"
  *
+ * kSCEntNetProxies Entity Keys
+ *
+ *   kSCPropNetProxiesSupplementalMatchDomains          "SupplementalMatchDomains"     CFArray[CFString]
+ *   kSCPropNetProxiesSupplementalMatchOrders           "SupplementalMatchOrders"      CFArray[CFNumber]
+ *
+ *   kSCPropNetProxiesScoped                            "__SCOPED__"                   CFDictionary
+ *   kSCPropNetProxiesSupplemental                      "__SUPPLEMENTAL__"             CFArray[CFDictionary]
+ *   kSCPropNetProxiesSupplementalMatchDomain           "__MATCH_DOMAIN__"             CFString
+ *
  * kSCEntNetService Entity Keys
  *
  *   kSCPropNetServicePrimaryRank                       "PrimaryRank"                  CFString
  *   kSCValNetServicePrimaryRankLast                    "Last"
  *   kSCValNetServicePrimaryRankNever                   "Never"
  *
+ * kSCEntNetVPN Entity Keys
+ *
+ *   kSCPropNetVPNAuthName                              "AuthName"                     CFString
+ *   kSCPropNetVPNAuthPassword                          "AuthPassword"                 CFString
+ *   kSCPropNetVPNAuthPasswordEncryption                "AuthPasswordEncryption"       CFString
+ *   kSCPropNetVPNAuthenticationMethod                  "AuthenticationMethod"         CFString
+ *   kSCPropNetVPNConnectTime                           "ConnectTime"                  CFString
+ *   kSCPropNetVPNDisconnectOnFastUserSwitch            "DisconnectOnFastUserSwitch"   CFNumber (0 or 1)
+ *   kSCPropNetVPNDisconnectOnIdle                      "DisconnectOnIdle"             CFNumber (0 or 1)
+ *   kSCPropNetVPNDisconnectOnIdleTimer                 "DisconnectOnIdleTimer"        CFNumber
+ *   kSCPropNetVPNDisconnectOnLogout                    "DisconnectOnLogout"           CFNumber (0 or 1)
+ *   kSCPropNetVPNDisconnectOnSleep                     "DisconnectOnSleep"            CFNumber (0 or 1)
+ *   kSCPropNetVPNLocalCertificate                      "LocalCertificate"             CFData
+ *   kSCPropNetVPNLogfile                               "Logfile"                      CFString
+ *   kSCPropNetVPNMTU                                   "MTU"                          CFNumber
+ *   kSCPropNetVPNOnDemandEnabled                       "OnDemandEnabled"              CFNumber (0 or 1)
+ *   kSCPropNetVPNOnDemandMatchDomainsAlways            "OnDemandMatchDomainsAlways"   CFArray[CFString]
+ *   kSCPropNetVPNOnDemandMatchDomainsOnRetry           "OnDemandMatchDomainsOnRetry"  CFArray[CFString]
+ *   kSCPropNetVPNOnDemandMatchDomainsNever             "OnDemandMatchDomainsNever"    CFArray[CFString]
+ *   kSCPropNetVPNRemoteAddress                         "RemoteAddress"                CFString
+ *   kSCPropNetVPNStatus                                "Status"                       CFNumber
+ *   kSCPropNetVPNVerboseLogging                        "VerboseLogging"               CFNumber (0 or 1)
+ *
+ *   --- kSCPropNetVPNAuthenticationMethod values ---
+ *   kSCValNetVPNAuthenticationMethodPassword           "Password"
+ *   kSCValNetVPNAuthenticationMethodCertificate        "Certificate"
+ *
+ *   --- kSCPropNetVPNAuthPasswordEncryption values ---
+ *   kSCValNetVPNAuthPasswordEncryptionKeychain         "Keychain"
+ *   kSCValNetVPNAuthPasswordEncryptionPrompt           "Prompt"
+ *
  * kSCCompSystem Properties
  *
  *   kSCPropSystemComputerNameRegion                    "ComputerNameRegion"           CFNumber
  *   kSCPropVirtualNetworkInterfacesBondMode            "Mode"                         CFNumber
  *   kSCPropVirtualNetworkInterfacesBondOptions         "Options"                      CFDictionary
  *
+ *   kSCPropVirtualNetworkInterfacesBridgeInterfaces    "Interfaces"                   CFArray[CFString]
+ *   kSCPropVirtualNetworkInterfacesBridgeOptions       "Options"                      CFDictionary
+ *
  *   kSCPropVirtualNetworkInterfacesVLANInterface       "Interface"                    CFString
  *   kSCPropVirtualNetworkInterfacesVLANTag             "Tag"                          CFNumber
  *   kSCPropVirtualNetworkInterfacesVLANOptions         "Options"                      CFDictionary
@@ -149,6 +234,12 @@ extern const CFStringRef kSCEntNetCommCenter;
  */
 extern const CFStringRef kSCEntNetEAPOL;
 
+/*!
+  @const kSCEntNetLoopback
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCEntNetLoopback;
+
 /*!
   @const kSCEntNetOnDemand
   @availability Introduced in Mac OS X 10.6.
@@ -161,6 +252,12 @@ extern const CFStringRef kSCEntNetOnDemand;
  */
 extern const CFStringRef kSCEntNetService;
 
+/*!
+  @const kSCEntNetVPN
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCEntNetVPN;
+
 /*!
   @group kSCCompNetwork Properties
  */
@@ -187,6 +284,86 @@ extern const CFStringRef kSCPropNetCommCenterAllowNetworkAccess;
  */
 extern const CFStringRef kSCPropNetCommCenterAvailable;
 
+/*!
+  @group kSCEntNetEthernet (Hardware) Entity Keys
+ */
+
+/*!
+  @const kSCPropNetEthernetCapabilityAV
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetEthernetCapabilityAV;
+
+/*!
+  @const kSCPropNetEthernetCapabilityJUMBO_MTU
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetEthernetCapabilityJUMBO_MTU;
+
+/*!
+  @const kSCPropNetEthernetCapabilityLRO
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetEthernetCapabilityLRO;
+
+/*!
+  @const kSCPropNetEthernetCapabilityRXCSUM
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetEthernetCapabilityRXCSUM;
+
+/*!
+  @const kSCPropNetEthernetCapabilityTSO
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetEthernetCapabilityTSO;
+
+/*!
+  @const kSCPropNetEthernetCapabilityTSO4
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetEthernetCapabilityTSO4;
+
+/*!
+  @const kSCPropNetEthernetCapabilityTSO6
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetEthernetCapabilityTSO6;
+
+/*!
+  @const kSCPropNetEthernetCapabilityTXCSUM
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetEthernetCapabilityTXCSUM;
+
+/*!
+  @const kSCPropNetEthernetCapabilityVLAN_HWTAGGING
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetEthernetCapabilityVLAN_HWTAGGING;
+
+/*!
+  @const kSCPropNetEthernetCapabilityVLAN_MTU
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetEthernetCapabilityVLAN_MTU;
+
+/*!
+  @group kSCEntNetInterface Entity Keys
+ */
+
+/*!
+  @const kSCValNetInterfaceTypeLoopback
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCValNetInterfaceTypeLoopback;
+
+/*!
+  @const kSCValNetInterfaceTypeVPN
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCValNetInterfaceTypeVPN;
+
 /*!
   @group kSCEntNetIPSec Entity Keys
  */
@@ -225,12 +402,76 @@ extern const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsNever;
   @group kSCEntNetIPv4 Entity Keys
  */
 
+/*!
+  @const kSCPropNetIPv4ExcludedRoutes
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetIPv4ExcludedRoutes;
+
+/*!
+  @const kSCPropNetIPv4IncludedRoutes
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetIPv4IncludedRoutes;
+
 /*!
   @const kSCValNetIPv4ConfigMethodFailover
   @availability Introduced in Mac OS X 10.5.
  */
 extern const CFStringRef kSCValNetIPv4ConfigMethodFailover;
 
+/*!
+  @const kSCPropNetIPv4RouteDestinationAddress
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetIPv4RouteDestinationAddress;
+
+/*!
+  @const kSCPropNetIPv4RouteSubnetMask
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetIPv4RouteSubnetMask;
+
+/*!
+  @const kSCPropNetIPv4RouteGatewayAddress
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetIPv4RouteGatewayAddress;
+
+/*!
+  @group kSCEntNetIPv6 Entity Keys
+ */
+
+/*!
+  @const kSCPropNetIPv6ExcludedRoutes
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetIPv6ExcludedRoutes;
+
+/*!
+  @const kSCPropNetIPv6IncludedRoutes
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetIPv6IncludedRoutes;
+
+/*!
+  @const kSCPropNetIPv6RouteDestinationAddress
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetIPv6RouteDestinationAddress;
+
+/*!
+  @const kSCPropNetIPv6RoutePrefixLength
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetIPv6RoutePrefixLength;
+
+/*!
+  @const kSCPropNetIPv6RouteGatewayAddress
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetIPv6RouteGatewayAddress;
+
 /*!
   @group kSCEntNetPPP Entity Keys
  */
@@ -253,6 +494,24 @@ extern const CFStringRef kSCPropNetPPPOnDemandEnabled;
  */
 extern const CFStringRef kSCPropNetPPPOnDemandHostName;
 
+/*!
+  @const kSCPropNetPPPOnDemandMatchDomainsAlways
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetPPPOnDemandMatchDomainsAlways;
+
+/*!
+  @const kSCPropNetPPPOnDemandMatchDomainsOnRetry
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetPPPOnDemandMatchDomainsOnRetry;
+
+/*!
+  @const kSCPropNetPPPOnDemandMatchDomainsNever
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetPPPOnDemandMatchDomainsNever;
+
 /*!
   @const kSCPropNetPPPOnDemandMode
   @availability Introduced in Mac OS X 10.5.
@@ -301,6 +560,40 @@ extern const CFStringRef kSCValNetPPPOnDemandPriorityHigh;
  */
 extern const CFStringRef kSCValNetPPPOnDemandPriorityLow;
 
+/*!
+  @group kSCEntNetProxies Entity Keys
+ */
+
+/*!
+  @const kSCPropNetProxiesSupplementalMatchDomains
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetProxiesSupplementalMatchDomains;
+
+/*!
+  @const kSCPropNetProxiesSupplementalMatchOrders
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetProxiesSupplementalMatchOrders;
+
+/*!
+  @const kSCPropNetProxiesScoped
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetProxiesScoped;
+
+/*!
+  @const kSCPropNetProxiesSupplemental
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetProxiesSupplemental;
+
+/*!
+  @const kSCPropNetProxiesSupplementalMatchDomain
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetProxiesSupplementalMatchDomain;
+
 /*!
   @group kSCEntNetService Entity Keys
  */
@@ -335,6 +628,154 @@ extern const CFStringRef kSCValNetServicePrimaryRankLast;
  */
 extern const CFStringRef kSCValNetServicePrimaryRankNever;
 
+/*!
+  @group kSCEntNetVPN Entity Keys
+ */
+
+/*!
+  @const kSCPropNetVPNAuthName
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNAuthName;
+
+/*!
+  @const kSCPropNetVPNAuthPassword
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNAuthPassword;
+
+/*!
+  @const kSCPropNetVPNAuthPasswordEncryption
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNAuthPasswordEncryption;
+
+/*!
+  @const kSCPropNetVPNAuthenticationMethod
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNAuthenticationMethod;
+
+/*!
+  @const kSCPropNetVPNConnectTime
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNConnectTime;
+
+/*!
+  @const kSCPropNetVPNDisconnectOnFastUserSwitch
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNDisconnectOnFastUserSwitch;
+
+/*!
+  @const kSCPropNetVPNDisconnectOnIdle
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNDisconnectOnIdle;
+
+/*!
+  @const kSCPropNetVPNDisconnectOnIdleTimer
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNDisconnectOnIdleTimer;
+
+/*!
+  @const kSCPropNetVPNDisconnectOnLogout
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNDisconnectOnLogout;
+
+/*!
+  @const kSCPropNetVPNDisconnectOnSleep
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNDisconnectOnSleep;
+
+/*!
+  @const kSCPropNetVPNLocalCertificate
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNLocalCertificate;
+
+/*!
+  @const kSCPropNetVPNLogfile
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNLogfile;
+
+/*!
+  @const kSCPropNetVPNMTU
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNMTU;
+
+/*!
+  @const kSCPropNetVPNOnDemandEnabled
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNOnDemandEnabled;
+
+/*!
+  @const kSCPropNetVPNOnDemandMatchDomainsAlways
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNOnDemandMatchDomainsAlways;
+
+/*!
+  @const kSCPropNetVPNOnDemandMatchDomainsOnRetry
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNOnDemandMatchDomainsOnRetry;
+
+/*!
+  @const kSCPropNetVPNOnDemandMatchDomainsNever
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNOnDemandMatchDomainsNever;
+
+/*!
+  @const kSCPropNetVPNRemoteAddress
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNRemoteAddress;
+
+/*!
+  @const kSCPropNetVPNStatus
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNStatus;
+
+/*!
+  @const kSCPropNetVPNVerboseLogging
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropNetVPNVerboseLogging;
+
+/*!
+  @const kSCValNetVPNAuthenticationMethodPassword
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCValNetVPNAuthenticationMethodPassword;
+
+/*!
+  @const kSCValNetVPNAuthenticationMethodCertificate
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCValNetVPNAuthenticationMethodCertificate;
+
+/*!
+  @const kSCValNetVPNAuthPasswordEncryptionKeychain
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCValNetVPNAuthPasswordEncryptionKeychain;
+
+/*!
+  @const kSCValNetVPNAuthPasswordEncryptionPrompt
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCValNetVPNAuthPasswordEncryptionPrompt;
+
 /*!
   @group kSCCompSystem Properties
  */
@@ -373,6 +814,18 @@ extern const CFStringRef kSCPropVirtualNetworkInterfacesBondMode;
  */
 extern const CFStringRef kSCPropVirtualNetworkInterfacesBondOptions;
 
+/*!
+  @const kSCPropVirtualNetworkInterfacesBridgeInterfaces
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropVirtualNetworkInterfacesBridgeInterfaces;
+
+/*!
+  @const kSCPropVirtualNetworkInterfacesBridgeOptions
+  @availability Introduced in Mac OS X 10.7.
+ */
+extern const CFStringRef kSCPropVirtualNetworkInterfacesBridgeOptions;
+
 /*!
   @const kSCPropVirtualNetworkInterfacesVLANInterface
   @availability Introduced in Mac OS X 10.5.
@@ -398,289 +851,563 @@ extern const CFStringRef kSCPropVirtualNetworkInterfacesVLANOptions;
 
 
   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
 
 
   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
+
+  SC_SCHEMA_DECLARATION(kSCEntNetLoopback, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCEntNetLoopback                                             \
+         SC_SCHEMA_KV(kSCEntNetLoopback                                \
+                     ,"Loopback"                                       \
+                     ,CFDictionary                                     )
 
   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
 
   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(kSCEntNetVPN, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCEntNetVPN                                                  \
+         SC_SCHEMA_KV(kSCEntNetVPN                                     \
+                     ,"VPN"                                            \
+                     ,CFDictionary                                     )
 
   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
 
 
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetCapabilityAV, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetEthernetCapabilityAV                                \
+         SC_SCHEMA_KV(kSCPropNetEthernetCapabilityAV                   \
+                     ,"AV"                                             \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetCapabilityJUMBO_MTU, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetEthernetCapabilityJUMBO_MTU                         \
+         SC_SCHEMA_KV(kSCPropNetEthernetCapabilityJUMBO_MTU            \
+                     ,"JUMBO_MTU"                                      \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetCapabilityLRO, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetEthernetCapabilityLRO                               \
+         SC_SCHEMA_KV(kSCPropNetEthernetCapabilityLRO                  \
+                     ,"LRO"                                            \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetCapabilityRXCSUM, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetEthernetCapabilityRXCSUM                            \
+         SC_SCHEMA_KV(kSCPropNetEthernetCapabilityRXCSUM               \
+                     ,"RXCSUM"                                         \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetCapabilityTSO, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetEthernetCapabilityTSO                               \
+         SC_SCHEMA_KV(kSCPropNetEthernetCapabilityTSO                  \
+                     ,"TSO"                                            \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetCapabilityTSO4, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetEthernetCapabilityTSO4                              \
+         SC_SCHEMA_KV(kSCPropNetEthernetCapabilityTSO4                 \
+                     ,"TSO4"                                           \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetCapabilityTSO6, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetEthernetCapabilityTSO6                              \
+         SC_SCHEMA_KV(kSCPropNetEthernetCapabilityTSO6                 \
+                     ,"TSO6"                                           \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetCapabilityTXCSUM, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetEthernetCapabilityTXCSUM                            \
+         SC_SCHEMA_KV(kSCPropNetEthernetCapabilityTXCSUM               \
+                     ,"TXCSUM"                                         \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetCapabilityVLAN_HWTAGGING, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetEthernetCapabilityVLAN_HWTAGGING                    \
+         SC_SCHEMA_KV(kSCPropNetEthernetCapabilityVLAN_HWTAGGING       \
+                     ,"VLAN_HWTAGGING"                                 \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetCapabilityVLAN_MTU, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetEthernetCapabilityVLAN_MTU                          \
+         SC_SCHEMA_KV(kSCPropNetEthernetCapabilityVLAN_MTU             \
+                     ,"VLAN_MTU"                                       \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeLoopback, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCValNetInterfaceTypeLoopback                                \
+         SC_SCHEMA_KV(kSCValNetInterfaceTypeLoopback                   \
+                     ,"Loopback"                                       \
+                     ,                                                 )
+
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeVPN, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCValNetInterfaceTypeVPN                                     \
+         SC_SCHEMA_KV(kSCValNetInterfaceTypeVPN                        \
+                     ,"VPN"                                            \
+                     ,                                                 )
+
   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
 
   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(kSCPropNetIPv4ExcludedRoutes, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetIPv4ExcludedRoutes                                  \
+         SC_SCHEMA_KV(kSCPropNetIPv4ExcludedRoutes                     \
+                     ,"ExcludedRoutes"                                 \
+                     ,CFArray[CFDictionary]                            )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4IncludedRoutes, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetIPv4IncludedRoutes                                  \
+         SC_SCHEMA_KV(kSCPropNetIPv4IncludedRoutes                     \
+                     ,"IncludedRoutes"                                 \
+                     ,CFArray[CFDictionary]                            )
 
   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
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4RouteDestinationAddress, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetIPv4RouteDestinationAddress                         \
+         SC_SCHEMA_KV(kSCPropNetIPv4RouteDestinationAddress            \
+                     ,"DestinationAddress"                             \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4RouteSubnetMask, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetIPv4RouteSubnetMask                                 \
+         SC_SCHEMA_KV(kSCPropNetIPv4RouteSubnetMask                    \
+                     ,"SubnetMask"                                     \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4RouteGatewayAddress, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetIPv4RouteGatewayAddress                             \
+         SC_SCHEMA_KV(kSCPropNetIPv4RouteGatewayAddress                \
+                     ,"GatewayAddress"                                 \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6ExcludedRoutes, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetIPv6ExcludedRoutes                                  \
+         SC_SCHEMA_KV(kSCPropNetIPv6ExcludedRoutes                     \
+                     ,"ExcludedRoutes"                                 \
+                     ,CFArray[CFDictionary]                            )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6IncludedRoutes, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetIPv6IncludedRoutes                                  \
+         SC_SCHEMA_KV(kSCPropNetIPv6IncludedRoutes                     \
+                     ,"IncludedRoutes"                                 \
+                     ,CFArray[CFDictionary]                            )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6RouteDestinationAddress, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetIPv6RouteDestinationAddress                         \
+         SC_SCHEMA_KV(kSCPropNetIPv6RouteDestinationAddress            \
+                     ,"DestinationAddress"                             \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6RoutePrefixLength, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetIPv6RoutePrefixLength                               \
+         SC_SCHEMA_KV(kSCPropNetIPv6RoutePrefixLength                  \
+                     ,"PrefixLength"                                   \
+                     ,CFNumber                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6RouteGatewayAddress, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetIPv6RouteGatewayAddress                             \
+         SC_SCHEMA_KV(kSCPropNetIPv6RouteGatewayAddress                \
+                     ,"GatewayAddress"                                 \
+                     ,CFString                                         )
 
   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
 
   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
 
   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
+
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandMatchDomainsAlways, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetPPPOnDemandMatchDomainsAlways                       \
+         SC_SCHEMA_KV(kSCPropNetPPPOnDemandMatchDomainsAlways          \
+                     ,"OnDemandMatchDomainsAlways"                     \
+                     ,CFArray[CFString]                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandMatchDomainsOnRetry, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetPPPOnDemandMatchDomainsOnRetry                      \
+         SC_SCHEMA_KV(kSCPropNetPPPOnDemandMatchDomainsOnRetry         \
+                     ,"OnDemandMatchDomainsOnRetry"                    \
+                     ,CFArray[CFString]                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandMatchDomainsNever, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetPPPOnDemandMatchDomainsNever                        \
+         SC_SCHEMA_KV(kSCPropNetPPPOnDemandMatchDomainsNever           \
+                     ,"OnDemandMatchDomainsNever"                      \
+                     ,CFArray[CFString]                                )
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
 
   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
+
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesSupplementalMatchDomains, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetProxiesSupplementalMatchDomains                     \
+         SC_SCHEMA_KV(kSCPropNetProxiesSupplementalMatchDomains        \
+                     ,"SupplementalMatchDomains"                       \
+                     ,CFArray[CFString]                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesSupplementalMatchOrders, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetProxiesSupplementalMatchOrders                      \
+         SC_SCHEMA_KV(kSCPropNetProxiesSupplementalMatchOrders         \
+                     ,"SupplementalMatchOrders"                        \
+                     ,CFArray[CFNumber]                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesScoped, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetProxiesScoped                                       \
+         SC_SCHEMA_KV(kSCPropNetProxiesScoped                          \
+                     ,"__SCOPED__"                                     \
+                     ,CFDictionary                                     )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesSupplemental, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetProxiesSupplemental                                 \
+         SC_SCHEMA_KV(kSCPropNetProxiesSupplemental                    \
+                     ,"__SUPPLEMENTAL__"                               \
+                     ,CFArray[CFDictionary]                            )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesSupplementalMatchDomain, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/))
+  #define kSCPropNetProxiesSupplementalMatchDomain                      \
+         SC_SCHEMA_KV(kSCPropNetProxiesSupplementalMatchDomain         \
+                     ,"__MATCH_DOMAIN__"                               \
+                     ,CFString                                         )
 
   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
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNAuthName, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNAuthName                                         \
+         SC_SCHEMA_KV(kSCPropNetVPNAuthName                            \
+                     ,"AuthName"                                       \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNAuthPassword, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNAuthPassword                                     \
+         SC_SCHEMA_KV(kSCPropNetVPNAuthPassword                        \
+                     ,"AuthPassword"                                   \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNAuthPasswordEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNAuthPasswordEncryption                           \
+         SC_SCHEMA_KV(kSCPropNetVPNAuthPasswordEncryption              \
+                     ,"AuthPasswordEncryption"                         \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNAuthenticationMethod, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNAuthenticationMethod                             \
+         SC_SCHEMA_KV(kSCPropNetVPNAuthenticationMethod                \
+                     ,"AuthenticationMethod"                           \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNConnectTime, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNConnectTime                                      \
+         SC_SCHEMA_KV(kSCPropNetVPNConnectTime                         \
+                     ,"ConnectTime"                                    \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNDisconnectOnFastUserSwitch, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNDisconnectOnFastUserSwitch                       \
+         SC_SCHEMA_KV(kSCPropNetVPNDisconnectOnFastUserSwitch          \
+                     ,"DisconnectOnFastUserSwitch"                     \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNDisconnectOnIdle, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNDisconnectOnIdle                                 \
+         SC_SCHEMA_KV(kSCPropNetVPNDisconnectOnIdle                    \
+                     ,"DisconnectOnIdle"                               \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNDisconnectOnIdleTimer, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNDisconnectOnIdleTimer                            \
+         SC_SCHEMA_KV(kSCPropNetVPNDisconnectOnIdleTimer               \
+                     ,"DisconnectOnIdleTimer"                          \
+                     ,CFNumber                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNDisconnectOnLogout, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNDisconnectOnLogout                               \
+         SC_SCHEMA_KV(kSCPropNetVPNDisconnectOnLogout                  \
+                     ,"DisconnectOnLogout"                             \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNDisconnectOnSleep, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNDisconnectOnSleep                                \
+         SC_SCHEMA_KV(kSCPropNetVPNDisconnectOnSleep                   \
+                     ,"DisconnectOnSleep"                              \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNLocalCertificate, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNLocalCertificate                                 \
+         SC_SCHEMA_KV(kSCPropNetVPNLocalCertificate                    \
+                     ,"LocalCertificate"                               \
+                     ,CFData                                           )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNLogfile, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNLogfile                                          \
+         SC_SCHEMA_KV(kSCPropNetVPNLogfile                             \
+                     ,"Logfile"                                        \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNMTU, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNMTU                                              \
+         SC_SCHEMA_KV(kSCPropNetVPNMTU                                 \
+                     ,"MTU"                                            \
+                     ,CFNumber                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNOnDemandEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNOnDemandEnabled                                  \
+         SC_SCHEMA_KV(kSCPropNetVPNOnDemandEnabled                     \
+                     ,"OnDemandEnabled"                                \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNOnDemandMatchDomainsAlways, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNOnDemandMatchDomainsAlways                       \
+         SC_SCHEMA_KV(kSCPropNetVPNOnDemandMatchDomainsAlways          \
+                     ,"OnDemandMatchDomainsAlways"                     \
+                     ,CFArray[CFString]                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNOnDemandMatchDomainsOnRetry, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNOnDemandMatchDomainsOnRetry                      \
+         SC_SCHEMA_KV(kSCPropNetVPNOnDemandMatchDomainsOnRetry         \
+                     ,"OnDemandMatchDomainsOnRetry"                    \
+                     ,CFArray[CFString]                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNOnDemandMatchDomainsNever, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNOnDemandMatchDomainsNever                        \
+         SC_SCHEMA_KV(kSCPropNetVPNOnDemandMatchDomainsNever           \
+                     ,"OnDemandMatchDomainsNever"                      \
+                     ,CFArray[CFString]                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNRemoteAddress, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNRemoteAddress                                    \
+         SC_SCHEMA_KV(kSCPropNetVPNRemoteAddress                       \
+                     ,"RemoteAddress"                                  \
+                     ,CFString                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNStatus, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNStatus                                           \
+         SC_SCHEMA_KV(kSCPropNetVPNStatus                              \
+                     ,"Status"                                         \
+                     ,CFNumber                                         )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetVPNVerboseLogging, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropNetVPNVerboseLogging                                   \
+         SC_SCHEMA_KV(kSCPropNetVPNVerboseLogging                      \
+                     ,"VerboseLogging"                                 \
+                     ,CFNumber (0 or 1)                                )
+
+  SC_SCHEMA_DECLARATION(kSCValNetVPNAuthenticationMethodPassword, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCValNetVPNAuthenticationMethodPassword                      \
+         SC_SCHEMA_KV(kSCValNetVPNAuthenticationMethodPassword         \
+                     ,"Password"                                       \
+                     ,                                                 )
+
+  SC_SCHEMA_DECLARATION(kSCValNetVPNAuthenticationMethodCertificate, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCValNetVPNAuthenticationMethodCertificate                   \
+         SC_SCHEMA_KV(kSCValNetVPNAuthenticationMethodCertificate      \
+                     ,"Certificate"                                    \
+                     ,                                                 )
+
+  SC_SCHEMA_DECLARATION(kSCValNetVPNAuthPasswordEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCValNetVPNAuthPasswordEncryptionKeychain                    \
+         SC_SCHEMA_KV(kSCValNetVPNAuthPasswordEncryptionKeychain       \
+                     ,"Keychain"                                       \
+                     ,                                                 )
+
+  SC_SCHEMA_DECLARATION(kSCValNetVPNAuthPasswordEncryptionPrompt, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCValNetVPNAuthPasswordEncryptionPrompt                      \
+         SC_SCHEMA_KV(kSCValNetVPNAuthPasswordEncryptionPrompt         \
+                     ,"Prompt"                                         \
+                     ,                                                 )
 
   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
 
   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 !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
 
   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
 
   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
+
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBridgeInterfaces, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropVirtualNetworkInterfacesBridgeInterfaces               \
+         SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBridgeInterfaces  \
+                     ,"Interfaces"                                     \
+                     ,CFArray[CFString]                                )
+
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBridgeOptions, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))
+  #define kSCPropVirtualNetworkInterfacesBridgeOptions                  \
+         SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBridgeOptions     \
+                     ,"Options"                                        \
+                     ,CFDictionary                                     )
 
   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
 
   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
 
   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 */
index 044107f3028632964bba5763dbb6aa88cd9da1f1..a1337bd7631e5f60185eca300768681d9c7e672f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -106,9 +106,9 @@ enum {
        /*
         * 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
+       kSCStatusConnectionNoService            = 5001, /* Network service for connection not available
+                                                          __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0)
+                                                        */
 };
 
 
index ed8bd369f54d45f258de0ea9fadbed341c80f9e3..0323b945a15c088a7f62387fdb028096123be410 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -336,7 +336,7 @@ SCVLANInterfaceCopyAll(SCPreferencesRef prefs)
 
 static void
 addAvailableInterfaces(CFMutableArrayRef available, CFArrayRef interfaces,
-                      CFSetRef exclude)
+                      CFSetRef excluded)
 {
        CFIndex i;
        CFIndex n;
@@ -349,8 +349,8 @@ addAvailableInterfaces(CFMutableArrayRef available, CFArrayRef interfaces,
                interface = CFArrayGetValueAtIndex(interfaces, i);
                interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
 
-               if (exclude != NULL
-                   && CFSetContainsValue(exclude, interface)) {
+               if ((excluded != NULL)
+                   && CFSetContainsValue(excluded, interface)) {
                        // exclude this interface
                        continue;
                }
@@ -368,8 +368,9 @@ CFArrayRef
 SCVLANInterfaceCopyAvailablePhysicalInterfaces()
 {
        CFMutableArrayRef       available;
-       CFArrayRef              bond_interfaces = NULL;
-       CFMutableSetRef         exclude = NULL;
+       CFArrayRef              bond_interfaces         = NULL;
+       CFArrayRef              bridge_interfaces       = NULL;
+       CFMutableSetRef         excluded                = NULL;
        CFArrayRef              interfaces;
        SCPreferencesRef        prefs;
 
@@ -378,17 +379,26 @@ SCVLANInterfaceCopyAvailablePhysicalInterfaces()
        prefs = SCPreferencesCreate(NULL, CFSTR("SCVLANInterfaceCopyAvailablePhysicalInterfaces"), NULL);
        if (prefs != NULL) {
                bond_interfaces = SCBondInterfaceCopyAll(prefs);
-               CFRelease(prefs);
                if (bond_interfaces != NULL) {
-                       exclude = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
-                       __SCBondInterfaceListCopyMembers(bond_interfaces, exclude);
+                       excluded = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+                       __SCBondInterfaceListCollectMembers(bond_interfaces, excluded);
                }
+
+               bridge_interfaces = SCBridgeInterfaceCopyAll(prefs);
+               if (bridge_interfaces != NULL) {
+                       if (excluded == NULL) {
+                               excluded = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+                       }
+                       __SCBridgeInterfaceListCollectMembers(bridge_interfaces, excluded);
+               }
+
+               CFRelease(prefs);
        }
 
-       // add real interfaces that aren't part of a bond
+       // add real interfaces that aren't part of a bond or bridge
        interfaces = __SCNetworkInterfaceCopyAll_IONetworkInterface();
        if (interfaces != NULL) {
-               addAvailableInterfaces(available, interfaces, exclude);
+               addAvailableInterfaces(available, interfaces, excluded);
                CFRelease(interfaces);
        }
 
@@ -397,8 +407,15 @@ SCVLANInterfaceCopyAvailablePhysicalInterfaces()
                addAvailableInterfaces(available, bond_interfaces, NULL);
                CFRelease(bond_interfaces);
        }
-       if (exclude != NULL) {
-               CFRelease(exclude);
+
+       // add bridge interfaces
+       if (bridge_interfaces != NULL) {
+               addAvailableInterfaces(available, bridge_interfaces, NULL);
+               CFRelease(bridge_interfaces);
+       }
+
+       if (excluded != NULL) {
+               CFRelease(excluded);
        }
 
        return available;
@@ -435,7 +452,7 @@ _SCVLANInterfaceCopyActive(void)
                SCNetworkInterfaceRef   vlan_physical;
                CFStringRef             vlan_physical_if;
                CFNumberRef             vlan_tag;
-               char                    vlr_parent[IFNAMSIZ + 1];
+               char                    vlr_parent[IFNAMSIZ];
                int                     vlr_tag;
                struct vlanreq          vreq;
 
@@ -448,7 +465,7 @@ _SCVLANInterfaceCopyActive(void)
 
                bzero(&ifr, sizeof(ifr));
                bzero(&vreq, sizeof(vreq));
-               strncpy(ifr.ifr_name, ifp->ifa_name, sizeof(ifr.ifr_name));
+               strlcpy(ifr.ifr_name, ifp->ifa_name, sizeof(ifr.ifr_name));
                ifr.ifr_data = (caddr_t)&vreq;
 
                if (ioctl(s, SIOCGIFVLAN, (caddr_t)&ifr) == -1) {
@@ -465,8 +482,7 @@ _SCVLANInterfaceCopyActive(void)
                CFRelease(vlan_if);
 
                // set the physical interface and tag
-               bzero(&vlr_parent, sizeof(vlr_parent));
-               bcopy(vreq.vlr_parent, vlr_parent, IFNAMSIZ);
+               strlcpy(vlr_parent, vreq.vlr_parent, sizeof(vlr_parent));
                vlan_physical_if = CFStringCreateWithCString(NULL, vlr_parent, kCFStringEncodingASCII);
                vlan_physical = _SCNetworkInterfaceCreateWithBSDName(NULL, vlan_physical_if,
                                                                     kIncludeBondInterfaces);
@@ -985,7 +1001,7 @@ _SCVLANInterfaceUpdateConfiguration(SCPreferencesRef prefs)
 
        /* configured VLANs */
        config = SCVLANInterfaceCopyAll(prefs);
-       nConfig = CFArrayGetCount(config);
+       nConfig = (config != NULL) ? CFArrayGetCount(config) : 0;
 
        /* physical interfaces */
        devices = CFDictionaryCreateMutable(NULL,
@@ -995,7 +1011,7 @@ _SCVLANInterfaceUpdateConfiguration(SCPreferencesRef prefs)
 
        /* active VLANs */
        active  = _SCVLANInterfaceCopyActive();
-       nActive = CFArrayGetCount(active);
+       nActive = (active != NULL) ? CFArrayGetCount(active) : 0;
 
        /* remove any no-longer-configured VLAN interfaces */
        for (i = 0; i < nActive; i++) {
diff --git a/SystemConfiguration.fproj/VPNConfiguration.c b/SystemConfiguration.fproj/VPNConfiguration.c
new file mode 100644 (file)
index 0000000..4e587a2
--- /dev/null
@@ -0,0 +1,4 @@
+/*
+ * Copyright (c) 2009-2011 Apple Inc. All rights reserved.
+ */
+
diff --git a/SystemConfiguration.fproj/VPNConfiguration.h b/SystemConfiguration.fproj/VPNConfiguration.h
new file mode 100644 (file)
index 0000000..4e587a2
--- /dev/null
@@ -0,0 +1,4 @@
+/*
+ * Copyright (c) 2009-2011 Apple Inc. All rights reserved.
+ */
+
diff --git a/SystemConfiguration.fproj/VPNPrivate.c b/SystemConfiguration.fproj/VPNPrivate.c
new file mode 100644 (file)
index 0000000..2dfbed3
--- /dev/null
@@ -0,0 +1,5 @@
+/*
+ * Copyright (c) 2009-2011 Apple Inc. All rights reserved.
+ */
+
+
diff --git a/SystemConfiguration.fproj/VPNPrivate.h b/SystemConfiguration.fproj/VPNPrivate.h
new file mode 100644 (file)
index 0000000..4e587a2
--- /dev/null
@@ -0,0 +1,4 @@
+/*
+ * Copyright (c) 2009-2011 Apple Inc. All rights reserved.
+ */
+
diff --git a/SystemConfiguration.fproj/VPNTunnel.c b/SystemConfiguration.fproj/VPNTunnel.c
new file mode 100644 (file)
index 0000000..4e587a2
--- /dev/null
@@ -0,0 +1,4 @@
+/*
+ * Copyright (c) 2009-2011 Apple Inc. All rights reserved.
+ */
+
diff --git a/SystemConfiguration.fproj/VPNTunnel.h b/SystemConfiguration.fproj/VPNTunnel.h
new file mode 100644 (file)
index 0000000..4e587a2
--- /dev/null
@@ -0,0 +1,4 @@
+/*
+ * Copyright (c) 2009-2011 Apple Inc. All rights reserved.
+ */
+
diff --git a/SystemConfiguration.fproj/VPNTunnelPrivate.h b/SystemConfiguration.fproj/VPNTunnelPrivate.h
new file mode 100644 (file)
index 0000000..4e587a2
--- /dev/null
@@ -0,0 +1,4 @@
+/*
+ * Copyright (c) 2009-2011 Apple Inc. All rights reserved.
+ */
+
index 9763e5b7857c7b0905972e74a8f845ec79c52acf..e35580e1bf85245345681877b4a0c9360d917f34 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2008, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include "dy_framework.h"
 
 
+
+#pragma mark -
+#pragma mark IOKit.framework APIs
+
 static void *
 __loadIOKit(void) {
        static void *image = NULL;
@@ -252,13 +256,18 @@ _IOServiceMatching(const char *name)
        return dyfunc ? dyfunc(name) : NULL;
 }
 
-#if    !TARGET_OS_IPHONE
+#pragma mark -
+#pragma mark Security.framework APIs
 
 static void *
 __loadSecurity(void) {
        static void *image = NULL;
        if (NULL == image) {
+#if    TARGET_OS_IPHONE
+               const char      *framework              = "/System/Library/Frameworks/Security.framework/Security";
+#else
                const char      *framework              = "/System/Library/Frameworks/Security.framework/Versions/A/Security";
+#endif
                struct stat     statbuf;
                const char      *suffix                 = getenv("DYLD_IMAGE_SUFFIX");
                char            path[MAXPATHLEN];
@@ -274,6 +283,27 @@ __loadSecurity(void) {
        return (void *)image;
 }
 
+#if    !TARGET_OS_IPHONE
+
+#define        SECURITY_FRAMEWORK_EXTERN(t, s)                         \
+       __private_extern__ t                                    \
+       _ ## s()                                                \
+       {                                                       \
+               static t        *dysym = NULL;                  \
+               if (!dysym) {                                   \
+                       void *image = __loadSecurity();         \
+                       if (image) dysym = dlsym(image, #s );   \
+               }                                               \
+               return (dysym != NULL) ? *dysym : NULL;         \
+       }
+
+SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecAttrService)
+SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecClass)
+SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecClassGenericPassword)
+SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecMatchLimit)
+SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecMatchLimitAll)
+SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecMatchSearchList)
+SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecReturnRef)
 
 __private_extern__ OSStatus
 _AuthorizationMakeExternalForm(AuthorizationRef authorization, AuthorizationExternalForm *extForm)
@@ -287,18 +317,6 @@ _AuthorizationMakeExternalForm(AuthorizationRef authorization, AuthorizationExte
        return dyfunc ? dyfunc(authorization, extForm) : -1;
 }
 
-__private_extern__ OSStatus
-_SecAccessCopySelectedACLList(SecAccessRef accessRef, CSSM_ACL_AUTHORIZATION_TAG action, CFArrayRef *aclList)
-{
-       #undef SecAccessCopySelectedACLList
-       static typeof (SecAccessCopySelectedACLList) *dyfunc = NULL;
-       if (!dyfunc) {
-               void *image = __loadSecurity();
-               if (image) dyfunc = dlsym(image, "SecAccessCopySelectedACLList");
-       }
-       return dyfunc ? dyfunc(accessRef, action, aclList) : -1;
-}
-
 __private_extern__ OSStatus
 _SecAccessCreate(CFStringRef descriptor, CFArrayRef trustedlist, SecAccessRef *accessRef)
 {
@@ -311,6 +329,7 @@ _SecAccessCreate(CFStringRef descriptor, CFArrayRef trustedlist, SecAccessRef *a
        return dyfunc ? dyfunc(descriptor, trustedlist, accessRef) : -1;
 }
 
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
 __private_extern__ OSStatus
 _SecAccessCreateFromOwnerAndACL(const CSSM_ACL_OWNER_PROTOTYPE *owner, uint32 aclCount, const CSSM_ACL_ENTRY_INFO *acls, SecAccessRef *accessRef)
 {
@@ -322,6 +341,31 @@ _SecAccessCreateFromOwnerAndACL(const CSSM_ACL_OWNER_PROTOTYPE *owner, uint32 ac
        }
        return dyfunc ? dyfunc(owner, aclCount, acls, accessRef) : -1;
 }
+#else  // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
+__private_extern__ SecAccessRef
+_SecAccessCreateWithOwnerAndACL(uid_t userId, gid_t groupId, SecAccessOwnerType ownerType, CFArrayRef acls, CFErrorRef *error)
+{
+#undef SecAccessCreateWithOwnerAndACL
+       static typeof (SecAccessCreateWithOwnerAndACL) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecAccessCreateWithOwnerAndACL");
+       }
+       return dyfunc ? dyfunc(userId, groupId, ownerType, acls, error) : NULL;
+}
+#endif // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
+
+__private_extern__ OSStatus
+_SecItemCopyMatching(CFDictionaryRef query, CFTypeRef *result)
+{
+#undef SecItemCopyMatching
+       static typeof (SecItemCopyMatching) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadSecurity();
+               if (image) dyfunc = dlsym(image, "SecItemCopyMatching");
+       }
+       return dyfunc ? dyfunc(query, result) : -1;
+}
 
 __private_extern__ OSStatus
 _SecKeychainCopyDomainDefault(SecPreferencesDomain domain, SecKeychainRef *keychain)
@@ -444,39 +488,28 @@ _SecKeychainItemModifyContent(SecKeychainItemRef itemRef, const SecKeychainAttri
 }
 
 __private_extern__ OSStatus
-_SecKeychainSearchCopyNext(SecKeychainSearchRef searchRef, SecKeychainItemRef *itemRef)
+_SecTrustedApplicationCreateFromPath(const char *path, SecTrustedApplicationRef *app)
 {
-       #undef SecKeychainSearchCopyNext
-       static typeof (SecKeychainSearchCopyNext) *dyfunc = NULL;
+       #undef SecTrustedApplicationCreateFromPath
+       static typeof (SecTrustedApplicationCreateFromPath) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadSecurity();
-               if (image) dyfunc = dlsym(image, "SecKeychainSearchCopyNext");
+               if (image) dyfunc = dlsym(image, "SecTrustedApplicationCreateFromPath");
        }
-       return dyfunc ? dyfunc(searchRef, itemRef) : -1;
+       return dyfunc ? dyfunc(path, app) : -1;
 }
 
-__private_extern__ OSStatus
-_SecKeychainSearchCreateFromAttributes(CFTypeRef keychainOrArray, SecItemClass itemClass, const SecKeychainAttributeList *attrList, SecKeychainSearchRef *searchRef)
-{
-       #undef SecKeychainSearchCreateFromAttributes
-       static typeof (SecKeychainSearchCreateFromAttributes) *dyfunc = NULL;
-       if (!dyfunc) {
-               void *image = __loadSecurity();
-               if (image) dyfunc = dlsym(image, "SecKeychainSearchCreateFromAttributes");
-       }
-       return dyfunc ? dyfunc(keychainOrArray, itemClass, attrList, searchRef) : -1;
-}
+#endif // !TARGET_OS_IPHONE
 
-__private_extern__ OSStatus
-_SecTrustedApplicationCreateFromPath(const char *path, SecTrustedApplicationRef *app)
+__private_extern__ SecCertificateRef
+_SecCertificateCreateWithData(CFAllocatorRef allocator, CFDataRef data)
 {
-       #undef SecTrustedApplicationCreateFromPath
-       static typeof (SecTrustedApplicationCreateFromPath) *dyfunc = NULL;
+       #undef SecCertificateCreateWithData
+       static typeof (SecCertificateCreateWithData) *dyfunc = NULL;
        if (!dyfunc) {
                void *image = __loadSecurity();
-               if (image) dyfunc = dlsym(image, "SecTrustedApplicationCreateFromPath");
+               if (image) dyfunc = dlsym(image, "SecCertificateCreateWithData");
        }
-       return dyfunc ? dyfunc(path, app) : -1;
+       return dyfunc ? dyfunc(allocator, data) : NULL;
 }
 
-#endif // !TARGET_OS_IPHONE
index cb5f201ae26b91110cd5fe073cdf4429eefb0533..84e3d10b7b22ebae953965d408034fdc0ee53bb6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2008, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <mach/mach.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <IOKit/IOKitLib.h>
-
-#if    !TARGET_OS_IPHONE
 #include <Security/Security.h>
-#endif // !TARGET_OS_IPHONE
+#include <Security/SecItem.h>  // only needed for Mac OS X 10.6[.x]
 
 __BEGIN_DECLS
 
@@ -161,6 +159,27 @@ _IOServiceMatching                 (
 
 #if    !TARGET_OS_IPHONE
 
+CFTypeRef _kSecAttrService();
+#define kSecAttrService _kSecAttrService()
+
+CFTypeRef _kSecClass();
+#define kSecClass _kSecClass()
+
+CFTypeRef _kSecClassGenericPassword();
+#define kSecClassGenericPassword _kSecClassGenericPassword()
+
+CFTypeRef _kSecMatchLimit();
+#define kSecMatchLimit _kSecMatchLimit()
+
+CFTypeRef _kSecMatchLimitAll();
+#define kSecMatchLimitAll _kSecMatchLimitAll()
+
+CFTypeRef _kSecMatchSearchList();
+#define kSecMatchSearchList _kSecMatchSearchList()
+
+CFTypeRef _kSecReturnRef();
+#define kSecReturnRef _kSecReturnRef()
+
 OSStatus
 _AuthorizationMakeExternalForm         (
                                        AuthorizationRef                authorization,
@@ -168,14 +187,6 @@ _AuthorizationMakeExternalForm             (
                                        );
 #define AuthorizationMakeExternalForm _AuthorizationMakeExternalForm
 
-OSStatus
-_SecAccessCopySelectedACLList          (
-                                       SecAccessRef                    accessRef,
-                                       CSSM_ACL_AUTHORIZATION_TAG      action,
-                                       CFArrayRef                      *aclList
-                                       );
-#define SecAccessCopySelectedACLList _SecAccessCopySelectedACLList
-
 OSStatus
 _SecAccessCreate                       (
                                        CFStringRef                     descriptor,
@@ -184,6 +195,7 @@ _SecAccessCreate                    (
                                        );
 #define SecAccessCreate _SecAccessCreate
 
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
 OSStatus
 _SecAccessCreateFromOwnerAndACL                (
                                        const CSSM_ACL_OWNER_PROTOTYPE  *owner,
@@ -192,6 +204,24 @@ _SecAccessCreateFromOwnerAndACL            (
                                        SecAccessRef                    *accessRef
                                        );
 #define SecAccessCreateFromOwnerAndACL _SecAccessCreateFromOwnerAndACL
+#else  // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
+SecAccessRef
+_SecAccessCreateWithOwnerAndACL                (
+                                       uid_t                           userId,
+                                       gid_t                           groupId,
+                                       SecAccessOwnerType              ownerType,
+                                       CFArrayRef                      acls,
+                                       CFErrorRef                      *error
+                                       );
+#define SecAccessCreateWithOwnerAndACL _SecAccessCreateWithOwnerAndACL
+#endif // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
+
+OSStatus
+_SecItemCopyMatching                   (
+                                       CFDictionaryRef                 query,
+                                       CFTypeRef                       *result
+                                       );
+#define SecItemCopyMatching _SecItemCopyMatching
 
 OSStatus
 _SecKeychainCopyDomainDefault          (
@@ -270,22 +300,6 @@ _SecKeychainItemModifyContent              (
                                        );
 #define SecKeychainItemModifyContent _SecKeychainItemModifyContent
 
-OSStatus
-_SecKeychainSearchCopyNext             (
-                                       SecKeychainSearchRef            searchRef,
-                                       SecKeychainItemRef              *itemRef
-                                       );
-#define SecKeychainSearchCopyNext _SecKeychainSearchCopyNext
-
-OSStatus
-_SecKeychainSearchCreateFromAttributes (
-                                       CFTypeRef                       keychainOrArray,
-                                       SecItemClass                    itemClass,
-                                       const SecKeychainAttributeList  *attrList,
-                                       SecKeychainSearchRef            *searchRef
-                                       );
-#define SecKeychainSearchCreateFromAttributes _SecKeychainSearchCreateFromAttributes
-
 OSStatus
 _SecTrustedApplicationCreateFromPath   (
                                        const char                      *path,
@@ -295,6 +309,13 @@ _SecTrustedApplicationCreateFromPath       (
 
 #endif // !TARGET_OS_IPHONE
 
+SecCertificateRef
+_SecCertificateCreateWithData(
+                             CFAllocatorRef allocator,
+                             CFDataRef data
+                             );
+#define SecCertificateCreateWithData _SecCertificateCreateWithData
+
 __END_DECLS
 
 #endif // _DY_FRAMEWORK_H
index dd435d5b2f96354d6f10d033b3171bf527ebbd71..ec98374c1936fcee28ad50cdda8791a9cbf0c707 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -59,7 +59,7 @@
 
 char copyright_string[] =
 "/*\n"
-" * Copyright (c) 2000-2009 Apple Inc. All rights reserved.\n"
+" * Copyright (c) 2000-2011 Apple Inc. All rights reserved.\n"
 " *\n"
 " * @APPLE_LICENSE_HEADER_START@\n"
 " * \n"
@@ -94,15 +94,19 @@ typedef enum {
        SC_10_4,
        SC_10_1_10_5,   // deprecated in 10.5
        SC_10_5,
+       SC_10_5_10_7,   // deprecated in 10.7
        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,
+       SC_10_7_IPHONE_4_0,
        COMMENT_PRIVATE,
        GROUP_PRIVATE,
        SC_10_5_PRIVATE,
        SC_10_6_IPHONE_2_0_PRIVATE,
        SC_10_6_IPHONE_3_0_PRIVATE,
+       SC_10_7_IPHONE_4_0_PRIVATE,
+       SC_10_7_IPHONE_5_0_PRIVATE,
        SC_IPHONE_2_0_PRIVATE,
        COMMENT_DEPRECATED,
        GROUP_DEPRECATED,
@@ -132,6 +136,7 @@ typedef enum {
 #define VERSION                        "Version"
 #define VIRTUALPROP            "PropVirtualNetworkInterfaces"
 
+#define CFARRAY_CFDICTIONARY   "CFArray[CFDictionary]"
 #define CFARRAY_CFNUMBER       "CFArray[CFNumber]"
 #define CFARRAY_CFSTRING       "CFArray[CFString]"
 #define CFBOOLEAN              "CFBoolean"
@@ -144,13 +149,14 @@ typedef enum {
 #define ACCESSPOINTNAME                "AccessPointName"
 #define ACSP                   "ACSP"                  // Apple Client Server Protocol
 #define ACTIVE                 "Active"
+#define ADDRESS                        "Address"
 #define ADDRESSES              "Addresses"
 #define AFTER                  "After"
 #define AGGRESSIVE             "Aggressive"
 #define AIRPORT                        "AirPort"
 #define ALERT                  "Alert"
 #define ALLOWNETCREATION       "AllowNetCreation"
-#define ALTERNATEREMOTEADDRESS "AlternateRemoteAddress"
+#define ALTERNATE              "Alternate"
 #define ALWAYS                 "Always"
 #define ANYREGEX               "AnyRegex"
 #define APPLETALK              "AppleTalk"
@@ -159,12 +165,16 @@ typedef enum {
 #define AUTOCONFIG             "AutoConfig"
 #define AUTODISCOVERY          "AutoDiscovery"
 #define AUTOMATIC              "Automatic"
+#define AV                     "AV"
 #define BEFORE                 "Before"
 #define BINDINGMETHODS         "BindingMethods"
 #define        BOND                    "Bond"
 #define BOOTP                  "BOOTP"
+#define        BRIDGE                  "Bridge"
 #define BROADCAST              "Broadcast"
 #define CALLWAITINGAUDIBLEALERT        "CallWaitingAudibleAlert"
+#define CAPABILITY             "Capability"
+#define CAPABILITIES           "Capabilities"
 #define CAUSE                  "Cause"
 #define CCP                    "CCP"
 #define CHAP                   "CHAP"
@@ -188,6 +198,7 @@ typedef enum {
 #define DEFAULT                        "Default"
 #define DEFAULTZONE            "DefaultZone"
 #define DEST                   "Dest"
+#define DESTINATION            "Destination"
 #define DETACHING              "Detaching"
 #define DEVICE                 "Device"
 #define DEVICENAME             "DeviceName"
@@ -218,6 +229,7 @@ typedef enum {
 #define ERRORCORRECTION                "ErrorCorrection"
 #define ETHERNET               "Ethernet"
 #define EXCEPTIONSLIST         "ExceptionsList"
+#define EXCLUDED               "Excluded"
 #define EXCLUDESIMPLEHOSTNAMES "ExcludeSimpleHostnames"
 #define FAILOVER               "Failover"
 #define FILE                   "File"
@@ -225,6 +237,7 @@ typedef enum {
 #define FIRST                  "First"
 #define FLAGS                  "Flags"
 #define FTP                    "FTP"
+#define GATEWAY                        "Gateway"
 #define GID                    "GID"
 #define GLOBAL                 "Global"
 #define GOPHER                 "Gopher"
@@ -241,6 +254,7 @@ typedef enum {
 #define IGNOREDIALTONE         "IgnoreDialTone"
 #define IGNORELINKSTATUS       "IgnoreLinkStatus"
 #define INACTIVE               "Inactive"
+#define INCLUDED               "Included"
 #define INFORM                 "INFORM"
 #define INTERFACE              "Interface"
 #define INTERFACENAME          "InterfaceName"
@@ -250,7 +264,9 @@ typedef enum {
 #define IPV4                   "IPv4"
 #define IPV6                   "IPv6"
 #define IPSEC                  "IPSec"
+#define JAVASCRIPT             "JavaScript"
 #define JOIN                   "Join"
+#define JUMBO_MTU              "JUMBO_MTU"
 #define KEYCHAIN               "Keychain"
 #define KEYID                  "KeyID"
 #define L2TP                   "L2TP"
@@ -262,7 +278,9 @@ typedef enum {
 #define LOCALHOSTNAME          "LocalHostName"
 #define LOCALIDENTIFIER                "LocalIdentifier"
 #define LOGFILE                        "Logfile"
+#define LOOPBACK               "Loopback"
 #define LOW                    "Low"
+#define LRO                    "LRO"
 #define MACADDRESS             "MACAddress"
 #define MANUAL                 "Manual"
 #define MATCH                  "Match"
@@ -332,11 +350,15 @@ typedef enum {
 #define REMOTEADDRESS          "RemoteAddress"
 #define RETRYCONNECTTIME       "RetryConnectTime"
 #define ROOTSEPARATOR          "RootSeparator"
+#define ROUTE                  "Route"
 #define ROUTER                 "Router"
+#define ROUTES                 "Routes"
 #define ROUTERADVERTISEMENT    "RouterAdvertisement"
 #define RTSP                   "RTSP"
+#define RXCSUM                 "RXCSUM"
 #define SAVEPASSWORDS          "SavePasswords"
 #define SCOPE                  "Scope"
+#define SCOPED                 "Scoped"
 #define SCRIPT                 "Script"
 #define SEARCH                 "Search"
 #define SEEDNETWORKRANGE       "SeedNetworkRange"
@@ -358,6 +380,7 @@ typedef enum {
 #define STATUS                 "Status"
 #define STF                    "6to4"
 #define STRONGEST              "Strongest"
+#define SUBNETMASK             "SubnetMask"
 #define SUBNETMASKS            "SubnetMasks"
 #define SUBTYPE                        "SubType"
 #define SUPPLEMENTAL           "Supplemental"
@@ -370,6 +393,10 @@ typedef enum {
 #define TOKEN                  "Token"
 #define TRANSMITACCM           "TransmitACCM"
 #define TRANSPORT              "Transport"
+#define TSO                    "TSO"
+#define TSO4                   "TSO4"
+#define TSO6                   "TSO6"
+#define TXCSUM                 "TXCSUM"
 #define TYPE                   "Type"
 #define UID                    "UID"
 #define UPDATED                        "Updated"
@@ -381,6 +408,9 @@ typedef enum {
 #define VERBOSELOGGING         "VerboseLogging"
 #define VIRTUALNETWORKINTERFACES       "VirtualNetworkInterfaces"
 #define        VLAN                    "VLAN"
+#define VLAN_HWTAGGING         "VLAN_HWTAGGING"
+#define VLAN_MTU               "VLAN_MTU"
+#define        VPN                     "VPN"
 #define WAITFORDIALTONE                "WaitForDialTone"
 #define WINS                   "WINS"
 #define WORKGROUP              "Workgroup"
@@ -473,8 +503,10 @@ static schemaDefinition names[] = {
   { GROUP_PRIVATE, NETENT, "Network Entity Keys", NULL, NULL },
 
     { SC_10_5_PRIVATE, NETENT, EAPOL, NULL, CFDICTIONARY },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETENT, LOOPBACK, NULL, CFDICTIONARY },
     { SC_10_6_IPHONE_3_0_PRIVATE, NETENT, ONDEMAND, NULL, CFDICTIONARY },
     { SC_10_6_IPHONE_2_0_PRIVATE, NETENT, SERVICE, "__SERVICE__", CFDICTIONARY },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETENT, VPN, NULL, CFDICTIONARY },
     { COMMENT_PRIVATE, "", NULL, NULL, NULL },
 
   { GROUP, NETPROP, KEY_PREFIX COMP NETWORK " Properties", NULL, NULL },
@@ -562,6 +594,20 @@ static schemaDefinition names[] = {
     { SC_10_2, NETPROP ETHERNET, MTU, NULL, CFNUMBER },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, NETPROP ETHERNET, KEY_PREFIX NETENT ETHERNET " (Hardware) Entity Keys", NULL, NULL },
+    
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP ETHERNET, CAPABILITY AV, AV, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP ETHERNET, CAPABILITY JUMBO_MTU, JUMBO_MTU, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP ETHERNET, CAPABILITY LRO, LRO, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP ETHERNET, CAPABILITY RXCSUM, RXCSUM, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP ETHERNET, CAPABILITY TSO, TSO, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP ETHERNET, CAPABILITY TSO4, TSO4, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP ETHERNET, CAPABILITY TSO6, TSO6, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP ETHERNET, CAPABILITY TXCSUM, TXCSUM, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP ETHERNET, CAPABILITY VLAN_HWTAGGING, VLAN_HWTAGGING, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP ETHERNET, CAPABILITY VLAN_MTU, VLAN_MTU, CFNUMBER_BOOL },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    
   { GROUP, NETPROP FIREWIRE, KEY_PREFIX NETENT FIREWIRE " (Hardware) Entity Keys", NULL, NULL },
 
     { COMMENT, "* RESERVED FOR FUTURE USE *", NULL, NULL, NULL },
@@ -588,6 +634,13 @@ static schemaDefinition names[] = {
     { SC_10_2, NETVAL INTERFACE SUBTYPE, PPTP, NULL, NULL },
     { SC_10_3, NETVAL INTERFACE SUBTYPE, L2TP, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
+    
+  { GROUP_PRIVATE, NETPROP INTERFACE, KEY_PREFIX NETENT INTERFACE " Entity Keys", NULL, NULL },
+    
+    { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP INTERFACE TYPE " values ---", NULL, NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETVAL INTERFACE TYPE, LOOPBACK, NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETVAL INTERFACE TYPE, VPN, NULL, NULL },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
 
   { GROUP, NETPROP IPSEC, KEY_PREFIX NETENT IPSEC " Entity Keys", NULL, NULL },
 
@@ -653,9 +706,18 @@ static schemaDefinition names[] = {
     { COMMENT, "", NULL, NULL, NULL },
 
   { GROUP_PRIVATE, NETPROP IPV4, KEY_PREFIX NETENT IPV4 " Entity Keys", NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP IPV4, EXCLUDED ROUTES, NULL, CFARRAY_CFDICTIONARY },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP IPV4, INCLUDED ROUTES, NULL, CFARRAY_CFDICTIONARY },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
     { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP IPV4 CONFIGMETHOD " values ---", NULL, NULL, NULL },
     { SC_10_5_PRIVATE, NETVAL IPV4 CONFIGMETHOD, FAILOVER, NULL, NULL },
     { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP IPV4 INCLUDED ROUTES ", "
+                             KEY_PREFIX NETPROP IPV4 EXCLUDED ROUTES " [CFDictionary] keys ---", NULL, NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP IPV4 ROUTE, DESTINATION ADDRESS, NULL, CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP IPV4 ROUTE, SUBNETMASK, NULL, CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP IPV4 ROUTE, GATEWAY ADDRESS, NULL, CFSTRING },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
 
   { GROUP, NETPROP IPV6, KEY_PREFIX NETENT IPV6 " Entity Keys", NULL, NULL },
 
@@ -668,11 +730,23 @@ static schemaDefinition names[] = {
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP IPV6 CONFIGMETHOD " values ---", NULL, NULL, NULL },
     { SC_10_3, NETVAL IPV6 CONFIGMETHOD, AUTOMATIC, NULL, NULL },
+    { SC_10_7_IPHONE_4_0, NETVAL IPV6 CONFIGMETHOD, LINKLOCAL, NULL, NULL },
     { SC_10_3, NETVAL IPV6 CONFIGMETHOD, MANUAL, NULL, NULL },
     { SC_10_3, NETVAL IPV6 CONFIGMETHOD, ROUTERADVERTISEMENT, NULL, NULL },
     { SC_10_3, NETVAL IPV6 CONFIGMETHOD, STF, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, NETPROP IPV6, KEY_PREFIX NETENT IPV6 " Entity Keys", NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP IPV6, EXCLUDED ROUTES, NULL, CFARRAY_CFDICTIONARY },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP IPV6, INCLUDED ROUTES, NULL, CFARRAY_CFDICTIONARY },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP IPV6 INCLUDED ROUTES ", "
+                             KEY_PREFIX NETPROP IPV6 EXCLUDED ROUTES " [CFDictionary] keys ---", NULL, NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP IPV6 ROUTE, DESTINATION ADDRESS, NULL, CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP IPV6 ROUTE, PREFIXLENGTH, NULL, CFNUMBER },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP IPV6 ROUTE, GATEWAY ADDRESS, NULL, CFSTRING },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    
   { GROUP, NETPROP STF, KEY_PREFIX NETENT STF " Entity Keys", NULL, NULL },
 
     { SC_10_3, NETPROP STF, RELAY, NULL, CFSTRING },
@@ -779,7 +853,7 @@ static schemaDefinition names[] = {
     { COMMENT, "", NULL, NULL, NULL },
 
     { COMMENT, "--- " COMM ": ---", NULL, NULL, NULL },
-    { SC_10_1, NETPROP PPP, COMM ALTERNATEREMOTEADDRESS, NULL, CFSTRING },
+    { SC_10_1, NETPROP PPP, COMM ALTERNATE REMOTEADDRESS, NULL, CFSTRING },
     { SC_10_1, NETPROP PPP, COMM CONNECTDELAY, NULL, CFNUMBER },
     { SC_10_1, NETPROP PPP, COMM DISPLAYTERMINALWINDOW, NULL, CFNUMBER_BOOL },
     { SC_10_1, NETPROP PPP, COMM REDIALCOUNT, NULL, CFNUMBER },
@@ -819,11 +893,9 @@ static schemaDefinition names[] = {
     { 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 },    // 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_7_IPHONE_5_0_PRIVATE, NETPROP PPP, ONDEMAND MATCH DOMAINS ALWAYS, NULL, CFARRAY_CFSTRING },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP PPP, ONDEMAND MATCH DOMAINS ONRETRY, NULL, CFARRAY_CFSTRING },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP PPP, ONDEMAND MATCH DOMAINS NEVER, NULL, CFARRAY_CFSTRING },
     { 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 },
@@ -891,10 +963,21 @@ static schemaDefinition names[] = {
     { SC_10_1, NETPROP PROXIES, SOCKS PORT, NULL, CFNUMBER },
     { SC_10_1, NETPROP PROXIES, SOCKS PROXY, NULL, CFSTRING },
     { SC_10_4, NETPROP PROXIES, PROXY AUTOCONFIG ENABLE, NULL, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_4_0, NETPROP PROXIES, PROXY AUTOCONFIG JAVASCRIPT, NULL, CFSTRING },
     { SC_10_4, NETPROP PROXIES, PROXY AUTOCONFIG URLSTRING, NULL, CFSTRING },
     { SC_10_4, NETPROP PROXIES, PROXY AUTODISCOVERY ENABLE, NULL, CFNUMBER_BOOL },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, NETPROP PROXIES, KEY_PREFIX NETENT PROXIES " Entity Keys", NULL, NULL },
+
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP PROXIES, SUPPLEMENTAL MATCH DOMAINS, NULL, CFARRAY_CFSTRING},
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP PROXIES, SUPPLEMENTAL MATCH ORDERS, NULL, CFARRAY_CFNUMBER},
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP PROXIES, SCOPED, "__SCOPED__", CFDICTIONARY},
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP PROXIES, SUPPLEMENTAL, "__SUPPLEMENTAL__", CFARRAY_CFDICTIONARY},
+    { SC_10_7_IPHONE_5_0_PRIVATE, NETPROP PROXIES, SUPPLEMENTAL MATCH DOMAIN, "__MATCH_DOMAIN__", CFSTRING},
+    { COMMENT_PRIVATE, "", 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 },
@@ -911,7 +994,7 @@ static schemaDefinition names[] = {
     { 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 },
+    { SC_10_5_10_7, NETPROP SMB, NETBIOS SCOPE, NULL, CFSTRING },
     { SC_10_5, NETPROP SMB, WINS ADDRESSES, NULL, CFARRAY_CFSTRING },
     { SC_10_5, NETPROP SMB, WORKGROUP, NULL, CFSTRING },
     { COMMENT, "", NULL, NULL, NULL },
@@ -923,6 +1006,38 @@ static schemaDefinition names[] = {
     { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, NETPROP VPN, KEY_PREFIX NETENT VPN " Entity Keys", NULL, NULL },
+
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, AUTH NAME, NULL, CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, AUTH PASSWORD, NULL, CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, AUTH PASSWORD ENCRYPTION, NULL, CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, AUTHENTICATIONMETHOD, NULL, CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, CONNECTTIME, NULL, CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, DISCONNECTONFASTUSERSWITCH, NULL, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, DISCONNECTONIDLE, NULL, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, DISCONNECTONIDLETIMER, NULL, CFNUMBER },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, DISCONNECTONLOGOUT, NULL, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, DISCONNECTONSLEEP, NULL, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, LOCALCERTIFICATE, NULL, CFDATA },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, LOGFILE, NULL, CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, MTU, NULL, CFNUMBER },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, ONDEMAND ENABLED, NULL, CFNUMBER_BOOL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, ONDEMAND MATCH DOMAINS ALWAYS, NULL, CFARRAY_CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, ONDEMAND MATCH DOMAINS ONRETRY, NULL, CFARRAY_CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, ONDEMAND MATCH DOMAINS NEVER, NULL, CFARRAY_CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, REMOTEADDRESS, NULL, CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, STATUS, NULL, CFNUMBER },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETPROP VPN, VERBOSELOGGING, NULL, CFNUMBER_BOOL },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP VPN AUTHENTICATIONMETHOD " values ---", NULL, NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETVAL VPN AUTHENTICATIONMETHOD, PASSWORD, NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETVAL VPN AUTHENTICATIONMETHOD, CERTIFICATE, NULL, NULL },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP VPN AUTH PASSWORD ENCRYPTION " values ---", NULL, NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETVAL VPN AUTH PASSWORD ENCRYPTION, KEYCHAIN, NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, NETVAL VPN AUTH PASSWORD ENCRYPTION, PROMPT, NULL, NULL },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+
   { GROUP, USERSENT CONSOLEUSER, KEY_PREFIX COMP USERS " Entity Keys", NULL, NULL },
 
     { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL },
@@ -967,15 +1082,16 @@ 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 },
     { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { SC_10_7_IPHONE_4_0_PRIVATE, VIRTUALPROP BRIDGE, INTERFACES, NULL, CFARRAY_CFSTRING },
+    { SC_10_7_IPHONE_4_0_PRIVATE, VIRTUALPROP BRIDGE, OPTIONS, NULL, CFDICTIONARY },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
     { 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 },
@@ -995,7 +1111,7 @@ static char        *maxkstr        = NULL;
 static int     maxvbuf         = 0;
 static char    *maxvstr        = NULL;
 
-static inline void
+static __inline__ void
 setmax(int *max, char **maxstr, char *str)
 {
     int l;
@@ -1086,6 +1202,11 @@ print_headerdoc(schemaDefinition *def)
                printf("  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.\n");
                break;
            case SC_10_5:
+               printf("  @availability Introduced in Mac OS X 10.5.\n");
+               break;
+           case SC_10_5_10_7:
+               printf("  @availability Introduced in Mac OS X 10.5, but later deprecated in Mac OS X 10.7.\n");
+               break;
            case SC_10_5_PRIVATE:
                printf("  @availability Introduced in Mac OS X 10.5.\n");
                break;
@@ -1103,6 +1224,11 @@ print_headerdoc(schemaDefinition *def)
            case SC_10_6_IPHONE_3_0_PRIVATE:
                printf("  @availability Introduced in Mac OS X 10.6.\n");
                break;
+           case SC_10_7_IPHONE_4_0:
+           case SC_10_7_IPHONE_4_0_PRIVATE:
+           case SC_10_7_IPHONE_5_0_PRIVATE:
+               printf("  @availability Introduced in Mac OS X 10.7.\n");
+               break;
            case SC_IPHONE_2_0_PRIVATE:
                printf("  @availability Introduced in iPhone OS 2.0.\n");
                break;
@@ -1149,6 +1275,11 @@ print_hfile(schemaDefinition *def)
                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:
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))\n", kbuf);
+               break;
+           case SC_10_5_10_7:
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_7,__IPHONE_NA,__IPHONE_NA))\n", kbuf);
+               break;
            case SC_10_5_PRIVATE:
                printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))\n", kbuf);
                break;
@@ -1166,6 +1297,13 @@ print_hfile(schemaDefinition *def)
            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_10_7_IPHONE_4_0:
+           case SC_10_7_IPHONE_4_0_PRIVATE:
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/))\n", kbuf);
+               break;
+           case SC_10_7_IPHONE_5_0_PRIVATE:
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_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;
@@ -1174,48 +1312,6 @@ print_hfile(schemaDefinition *def)
                break;
        }
 
-       switch (def->control) {
-           case SC_10_1:
-               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) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n");
-               break;
-           case SC_10_3:
-               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) || (__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) || (__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;
-       }
-
        printf("  #define %-48s              \\\n",
               kbuf);
        printf("          " SC_SCHEMA_KV "(%-48s \\\n",
@@ -1225,26 +1321,6 @@ print_hfile(schemaDefinition *def)
        printf("                      ,%-48s )\n",
               def->type ? def->type : "");
 
-       switch (def->control) {
-           case SC_10_1:
-           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;
-       }
-
        return;
 }
 
@@ -1401,6 +1477,8 @@ dump_names(int type)
                            case SC_10_5_PRIVATE:
                            case SC_10_6_IPHONE_2_0_PRIVATE:
                            case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_10_7_IPHONE_4_0_PRIVATE:
+                           case SC_10_7_IPHONE_5_0_PRIVATE:
                            case SC_IPHONE_2_0_PRIVATE:
                                // don't report private definitions
                                break;
@@ -1420,6 +1498,8 @@ dump_names(int type)
                            case SC_10_5_PRIVATE:
                            case SC_10_6_IPHONE_2_0_PRIVATE:
                            case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_10_7_IPHONE_4_0_PRIVATE:
+                           case SC_10_7_IPHONE_5_0_PRIVATE:
                            case SC_IPHONE_2_0_PRIVATE:
                                print_comment(&names[i]);
                                break;
@@ -1434,6 +1514,8 @@ dump_names(int type)
                            case SC_10_5_PRIVATE:
                            case SC_10_6_IPHONE_2_0_PRIVATE:
                            case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_10_7_IPHONE_4_0_PRIVATE:
+                           case SC_10_7_IPHONE_5_0_PRIVATE:
                            case SC_IPHONE_2_0_PRIVATE:
                                // don't report private definitions
                                break;
@@ -1447,6 +1529,8 @@ dump_names(int type)
                            case SC_10_5_PRIVATE:
                            case SC_10_6_IPHONE_2_0_PRIVATE:
                            case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_10_7_IPHONE_4_0_PRIVATE:
+                           case SC_10_7_IPHONE_5_0_PRIVATE:
                            case SC_IPHONE_2_0_PRIVATE:
                                print_headerdoc(&names[i]);
                                break;
@@ -1461,6 +1545,8 @@ dump_names(int type)
                            case SC_10_5_PRIVATE:
                            case SC_10_6_IPHONE_2_0_PRIVATE:
                            case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_10_7_IPHONE_4_0_PRIVATE:
+                           case SC_10_7_IPHONE_5_0_PRIVATE:
                            case SC_IPHONE_2_0_PRIVATE:
                                break;
                                // don't report private definitions
@@ -1474,6 +1560,8 @@ dump_names(int type)
                            case SC_10_5_PRIVATE:
                            case SC_10_6_IPHONE_2_0_PRIVATE:
                            case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_10_7_IPHONE_4_0_PRIVATE:
+                           case SC_10_7_IPHONE_5_0_PRIVATE:
                            case SC_IPHONE_2_0_PRIVATE:
                                print_hfile(&names[i]);
                                break;
@@ -1577,24 +1665,6 @@ main(int argc, char * argv[])
        printf("#include <TargetConditionals.h>\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 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 <CoreFoundation/CFString.h>\n");
-       printf("    #define SCSTR(s) CFSTR(s)\n");
-       printf("  #endif\n");
-       printf("  #ifndef " SC_SCHEMA_DECLARATION "\n");
-       printf("    #define " SC_SCHEMA_DECLARATION "(k,q)\textern const CFStringRef k q;\n");
-       printf("  #endif\n");
-       printf("  #ifndef " SC_SCHEMA_KV "\n");
-       printf("    #define " SC_SCHEMA_KV "(k,v,t)\tSCSTR( v )\n");
-       printf("  #endif\n");
-       printf("#endif\n\n");
-
        printf("/*\n");
        printf(" * Define a schema key/value/type tuple\n");
        printf(" */\n");
@@ -1615,14 +1685,6 @@ main(int argc, char * argv[])
        printf("  #endif\n");
        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) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)\n");
-       printf("  #ifndef SCSTR\n");
-       printf("    #include <CoreFoundation/CFString.h>\n");
-       printf("    #define SCSTR(s) CFSTR(s)\n");
-       printf("  #endif\n");
-       printf("#endif\n\n\n");
-
        printf("/* -------------------- HeaderDoc comments -------------------- */\n\n\n");
        printf("#if\t0\n");
        printf("/*!\n");
index 638008f408f34ae330c29e0bc3b0cd0de56cd551..7c69a2fcd985c2ce6f0583f6f5dedec90ec41143 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2007, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/wait.h>
+#include <mach/mach.h>
+#include <mach/mach_error.h>
+#include <servers/bootstrap.h>
+#include <bootstrap_priv.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include "SCHelper_client.h"
-#include "helper_comm.h"
+#include "helper.h"            // MiG generated file
 
 
 #define        HELPER                                  "SCHelper"
 #define        SUFFIX_SYM_LEN                          (sizeof(SUFFIX_SYM) - 1)
 
 
+static pthread_mutex_t _helper_lock    = PTHREAD_MUTEX_INITIALIZER;
+static mach_port_t     _helper_server  = MACH_PORT_NULL;
+
+
+static mach_port_t
+__SCHelperServerPort(kern_return_t *status)
+{
+       mach_port_t     server  = MACH_PORT_NULL;
+       char            *server_name;
+
+       server_name = getenv("SCHELPER_SERVER");
+       if (!server_name) {
+               server_name = SCHELPER_SERVER;
+       }
+
+#ifdef BOOTSTRAP_PRIVILEGED_SERVER
+       *status = bootstrap_look_up2(bootstrap_port,
+                                    server_name,
+                                    &server,
+                                    0,
+                                    BOOTSTRAP_PRIVILEGED_SERVER);
+#else  // BOOTSTRAP_PRIVILEGED_SERVER
+       *status = bootstrap_look_up(bootstrap_port, server_name, &server);
+#endif // BOOTSTRAP_PRIVILEGED_SERVER
+
+       switch (*status) {
+               case BOOTSTRAP_SUCCESS :
+                       /* service currently registered, "a good thing" (tm) */
+                       return server;
+               case BOOTSTRAP_NOT_PRIVILEGED :
+                       /* the service is not privileged */
+                       break;
+               case BOOTSTRAP_UNKNOWN_SERVICE :
+                       /* service not currently registered, try again later */
+                       break;
+               default :
+#ifdef DEBUG
+                       SCLog(_sc_verbose, LOG_DEBUG,
+                             CFSTR("__SCHelperServerPort bootstrap_look_up() failed: status=%s"),
+                             bootstrap_strerror(*status));
+#endif /* DEBUG */
+                       break;
+       }
+
+       return MACH_PORT_NULL;
+}
+
+
 __private_extern__
-int
-_SCHelperOpen(CFDataRef authorizationData)
+Boolean
+_SCHelperOpen(CFDataRef authorizationData, mach_port_t *helper_port)
 {
+       kern_return_t           kr;
        Boolean                 ok;
-       int                     sock;
-       struct sockaddr_un      sun;
+       mach_port_t             server;
        uint32_t                status  = 0;
-       static int              yes     = 1;
 
-       if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
-               perror("_SCHelperOpen socket() failed");
-               return -1;
-       }
+       *helper_port = MACH_PORT_NULL;
+
+       // open a new session with the server
+       server = _helper_server;
+       while (TRUE) {
+               if (server != MACH_PORT_NULL) {
+                       kr = helperinit(server,
+                                       helper_port,
+                                       &status);
+                       if (kr == KERN_SUCCESS) {
+                               break;
+                       }
+
+                       // our [cached] server port is not valid
+                       if (kr != MACH_SEND_INVALID_DEST) {
+                               // if we got an unexpected error, don't retry
+                               status = kr;
+                               break;
+                       }
+               }
 
-       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;
+               pthread_mutex_lock(&_helper_lock);
+               if (_helper_server != MACH_PORT_NULL) {
+                       if (server == _helper_server) {
+                               // if the server we tried returned the error
+                               (void)mach_port_deallocate(mach_task_self(), _helper_server);
+                               _helper_server = __SCHelperServerPort(&kr);
+                               if (_helper_server == MACH_PORT_NULL) {
+                                       status = kr;
+                               }
+                       } else {
+                               // another thread has refreshed the SCHelper server port
+                       }
+               } else {
+                       _helper_server = __SCHelperServerPort(&kr);
+                       if (_helper_server == MACH_PORT_NULL) {
+                               status = kr;
+                       }
+               }
+               server = _helper_server;
+               pthread_mutex_unlock(&_helper_lock);
+
+               if (server == MACH_PORT_NULL) {
+                       // if SCHelper server not available
+                       break;
+               }
        }
+       __MACH_PORT_DEBUG(TRUE, "*** _SCHelperOpen", *helper_port);
 
-       if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (const void *)&yes, sizeof(yes)) == -1) {
-               perror("_SCHelperOpen setsockopt() failed");
-               close(sock);
-               return -1;
+       if (*helper_port == MACH_PORT_NULL) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("_SCHelperOpen: could not contact server: %s"),
+                     SCErrorString(status));
+               return FALSE;
        }
 
-       ok = _SCHelperExec(sock, SCHELPER_MSG_AUTH, authorizationData, &status, NULL);
+       ok = _SCHelperExec(*helper_port, SCHELPER_MSG_AUTH, authorizationData, &status, NULL);
        if (!ok) {
                SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen: could not send authorization"));
-               close(sock);
-               return -1;
+               goto error;
        }
 
        ok = (status == 0);
        if (!ok) {
                SCLog(TRUE, LOG_INFO, CFSTR("could not start \"" HELPER "\", status = %u"), status);
-               close(sock);
-               return -1;
+               goto error;
+       }
+
+       return TRUE;
+
+    error :
+
+       if (*helper_port != MACH_PORT_NULL) {
+               (void)mach_port_deallocate(mach_task_self(), *helper_port);
+               *helper_port = MACH_PORT_NULL;
        }
 
-       return sock;
+       return FALSE;
+
 }
 
 
 __private_extern__
 void
-_SCHelperClose(int helper)
+_SCHelperClose(mach_port_t *helper_port)
 {
-       if (!_SCHelperExec(helper, SCHELPER_MSG_EXIT, NULL, NULL, NULL)) {
+       if (!_SCHelperExec(*helper_port, SCHELPER_MSG_EXIT, NULL, NULL, NULL)) {
                SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen: could not send exit request"));
        }
 
-       (void)close(helper);
+       if (*helper_port != MACH_PORT_NULL) {
+               (void)mach_port_deallocate(mach_task_self(), *helper_port);
+               *helper_port = MACH_PORT_NULL;
+       }
+
        return;
 }
+
+
+Boolean
+_SCHelperExec(mach_port_t port, uint32_t msgID, CFDataRef data, uint32_t *status, CFDataRef *reply)
+{
+       kern_return_t           kr;
+       CFDataRef               myData          = NULL;
+       xmlDataOut_t            replyRef        = NULL;         /* raw bytes */
+       mach_msg_type_number_t  replyLen        = 0;
+       uint32_t                replyStatus     = 0;
+
+       kr = helperexec(port,
+                       msgID,
+                       (data != NULL) ? (void *)CFDataGetBytePtr(data) : NULL,
+                       (data != NULL) ? CFDataGetLength(data)  : 0,
+                       &replyStatus,
+                       &replyRef,
+                       &replyLen);
+       if (kr != KERN_SUCCESS) {
+               if (replyRef != NULL) {
+                       (void) vm_deallocate(mach_task_self(), (vm_address_t)replyRef, replyLen);
+               }
+
+               if (kr != MACH_SEND_INVALID_DEST) {
+                       // if we got an unexpected error
+                       SCLog(TRUE, LOG_ERR, CFSTR("_SCHelperExec() failed: %s"), mach_error_string(kr));
+               }
+               _SCErrorSet(kr);
+
+               return FALSE;
+       }
+
+       // un-serialize the reply
+       if (replyRef != NULL) {
+               if (!_SCUnserializeData(&myData, replyRef, replyLen)) {
+                       return FALSE;
+               }
+       }
+
+       if (status != NULL) {
+               *status = replyStatus;
+       }
+
+       if (reply != NULL) {
+               *reply = myData;
+       } else if (myData != NULL) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("_SCHelperExec() data available with no place to go"));
+               CFRelease(myData);
+       }
+
+       return TRUE;
+}
index 74d78eb1b631e8a40bd45d947b775a3f4613faed..02ecf7576f10d27b2a867f0049a67509897cba13 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2007, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -67,15 +67,16 @@ enum {
 
 __BEGIN_DECLS
 
-int    _SCHelperOpen   (CFDataRef              authorizationData);
+Boolean        _SCHelperOpen   (CFDataRef              authorizationData,
+                        mach_port_t            *helper_port);
 
-Boolean        _SCHelperExec   (int                    helper,
+Boolean        _SCHelperExec   (mach_port_t            helper_port,
                         uint32_t               msgID,
                         CFDataRef              data,
                         uint32_t               *status,
                         CFDataRef              *reply);
 
-void   _SCHelperClose  (int                    helper);
+void   _SCHelperClose  (mach_port_t            *helper_port);
 
 __END_DECLS
 
index cdf3fd3dae78c501e7c8d5d3f4de5abcf71d9368..c7efc4cccb845d419119413e1f91bf8e37331172 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
 
-#include <stdlib.h>
 #include <getopt.h>
+#include <grp.h>
+#include <launch.h>
+#include <pthread.h>
+#include <stdlib.h>
 #include <unistd.h>
+#include <bsm/libbsm.h>
 #include <sys/types.h>
+#include <sysexits.h>
+
+//#define DEBUG_MACH_PORT_ALLOCATIONS
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include <SystemConfiguration/SCValidation.h>
-#include <pthread.h>
-#include <sysexits.h>
 
 #include "SCPreferencesInternal.h"
 #include "SCHelper_client.h"
-#include "helper_comm.h"
+#include "helper_types.h"
+
+
+#pragma mark -
+#pragma mark SCHelper session managment
 
 
 #if    TARGET_OS_IPHONE
-#include <grp.h>
 
-__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
+//
+// entitlement used to control write access to a given "prefsID"
+//
+#define        kSCWriteEntitlementName         CFSTR("com.apple.SystemConfiguration.SCPreferences-write-access")
 
+//
+// entitlement used to allow limited [VPN configuration] write access to the "preferences.plist"
+//
+#define kSCVPNFilterEntitlementName    CFSTR("com.apple.networking.vpn.configuration")
 
-#pragma mark -
-#pragma mark Session managment
+#endif // TARGET_OS_IPHONE
 
 
+typedef        enum { NO = 0, YES, UNKNOWN } lazyBoolean;
+
 typedef const struct __SCHelperSession * SCHelperSessionRef;
 
 typedef struct {
@@ -62,12 +72,24 @@ typedef struct {
        // base CFType information
        CFRuntimeBase           cfBase;
 
+       // per session lock
+       pthread_mutex_t         lock;
+
        // authorization
        AuthorizationRef        authorization;
-#if    TARGET_OS_IPHONE
-       uid_t                   peer_euid;
-       gid_t                   peer_egid;
-#endif // TARGET_OS_IPHONE
+
+       // session mach port
+       mach_port_t             port;
+       CFMachPortRef           mp;
+
+       // Mach security audit trailer for evaluating credentials
+       audit_token_t           auditToken;
+
+       // write access entitlement associated with this session
+       lazyBoolean             callerWriteAccess;
+
+       // VPN configuration filtering
+       CFArrayRef              vpnFilter;
 
        // preferences
        SCPreferencesRef        prefs;
@@ -75,6 +97,23 @@ typedef struct {
 } SCHelperSessionPrivate, *SCHelperSessionPrivateRef;
 
 
+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 int             sessions_generation             = 0;
+static pthread_mutex_t sessions_lock                   = PTHREAD_MUTEX_INITIALIZER;
+
+
+#pragma mark -
+
+
 static AuthorizationRef
 __SCHelperSessionGetAuthorization(SCHelperSessionRef session)
 {
@@ -90,6 +129,8 @@ __SCHelperSessionSetAuthorization(SCHelperSessionRef session, CFTypeRef authoriz
        Boolean                         ok              = TRUE;
        SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
 
+       pthread_mutex_lock(&sessionPrivate->lock);
+
 #if    !TARGET_OS_IPHONE
        if (sessionPrivate->authorization != NULL) {
                AuthorizationFree(sessionPrivate->authorization, kAuthorizationFlagDefaults);
@@ -126,70 +167,161 @@ __SCHelperSessionSetAuthorization(SCHelperSessionRef session, CFTypeRef authoriz
        }
 #endif // !TARGET_OS_IPHONE
 
+       pthread_mutex_unlock(&sessionPrivate->lock);
+
        return ok;
 }
 
 
-#if    TARGET_OS_IPHONE
+static SCPreferencesRef
+__SCHelperSessionGetPreferences(SCHelperSessionRef session)
+{
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
+
+       return sessionPrivate->prefs;
+}
+
+
 static void
-__SCHelperSessionGetCredentials(SCHelperSessionRef session, uid_t *euid, gid_t *egid)
+__SCHelperSessionSetThreadName(SCHelperSessionRef session)
 {
+       char                            *caller         = NULL;
+       char                            name[64];
+       char                            *path           = NULL;
+       char                            *path_s         = NULL;
        SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
 
-       if (euid != NULL) *euid = sessionPrivate->peer_euid;
-       if (egid != NULL) *egid = sessionPrivate->peer_egid;
+
+       if (sessionPrivate->mp == NULL) {
+               return;
+       }
+
+       if (sessionPrivate->prefs != NULL) {
+               SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)sessionPrivate->prefs;
+
+               if (prefsPrivate->name != NULL) {
+                       caller = _SC_cfstring_to_cstring(prefsPrivate->name,
+                                                        NULL,
+                                                        0,
+                                                        kCFStringEncodingUTF8);
+               }
+
+               path = (prefsPrivate->newPath != NULL) ? prefsPrivate->newPath : prefsPrivate->path;
+               if (path != NULL) {
+                       path_s = strrchr(path, '/');
+                       if (path_s != NULL) {
+                               path = path_s;
+                       }
+               }
+       }
+
+       if (caller != NULL) {
+               snprintf(name, sizeof(name), "SESSION|%p|%s|%s%s",
+                       (void *)(uintptr_t)CFMachPortGetPort(sessionPrivate->mp),
+                       (caller != NULL) ? caller : "?",
+                       (path_s != NULL) ? "*/"   : "",
+                       (path   != NULL) ? path   : "?");
+               CFAllocatorDeallocate(NULL, caller);
+       } else {
+               snprintf(name, sizeof(name), "SESSION|%p",
+                        (void *)(uintptr_t)CFMachPortGetPort(sessionPrivate->mp));
+       }
+
+       pthread_setname_np(name);
+
        return;
 }
 
 
 static Boolean
-__SCHelperSessionSetCredentials(SCHelperSessionRef session, uid_t euid, gid_t egid)
+__SCHelperSessionSetPreferences(SCHelperSessionRef session, SCPreferencesRef prefs)
 {
        SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
 
-       sessionPrivate->peer_euid = euid;
-       sessionPrivate->peer_egid = egid;
+       pthread_mutex_lock(&sessionPrivate->lock);
+
+       if (prefs != NULL) {
+               CFRetain(prefs);
+       }
+       if (sessionPrivate->prefs != NULL) {
+               SCLog(debug, LOG_DEBUG,
+                     CFSTR("%p : close"),
+                     session);
+               CFRelease(sessionPrivate->prefs);
+       }
+       if (prefs != NULL) {
+               SCLog(debug, LOG_DEBUG,
+                     CFSTR("%p : open, prefs = %@"),
+                     session,
+                     prefs);
+       }
+       sessionPrivate->prefs = prefs;
+
+       __SCHelperSessionSetThreadName(session);
+
+       pthread_mutex_unlock(&sessionPrivate->lock);
+
        return TRUE;
 }
-#endif // TARGET_OS_IPHONE
 
-static SCPreferencesRef
-__SCHelperSessionGetPreferences(SCHelperSessionRef session)
+
+static CFArrayRef
+__SCHelperSessionGetVPNFilter(SCHelperSessionRef session)
 {
        SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
 
-       return sessionPrivate->prefs;
+       return sessionPrivate->vpnFilter;
 }
 
 
 static Boolean
-__SCHelperSessionSetPreferences(SCHelperSessionRef session, SCPreferencesRef prefs)
+__SCHelperSessionSetVPNFilter(SCHelperSessionRef session, CFArrayRef vpnFilter)
 {
        SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
 
-       if (prefs != NULL) {
-               CFRetain(prefs);
+       pthread_mutex_lock(&sessionPrivate->lock);
+
+       if (vpnFilter != NULL) {
+               CFRetain(vpnFilter);
        }
-       if (sessionPrivate->prefs != NULL) {
-               CFRelease(sessionPrivate->prefs);
+       if (sessionPrivate->vpnFilter != NULL) {
+               CFRelease(sessionPrivate->vpnFilter);
        }
-       sessionPrivate->prefs = prefs;
+       sessionPrivate->vpnFilter = vpnFilter;
+
+       pthread_mutex_unlock(&sessionPrivate->lock);
 
        return TRUE;
 }
 
 
-static CFStringRef     __SCHelperSessionCopyDescription        (CFTypeRef cf);
-static void            __SCHelperSessionDeallocate             (CFTypeRef cf);
+static void
+__SCHelperSessionLog(const void *value, void *context)
+{
+       SCHelperSessionRef              session         = (SCHelperSessionRef)value;
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
 
+       pthread_mutex_lock(&sessionPrivate->lock);
 
-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;
+       if ((sessionPrivate->mp != NULL) && (sessionPrivate->prefs != NULL)) {
+               SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)sessionPrivate->prefs;
+
+               SCLog(TRUE, LOG_NOTICE,
+                     CFSTR("  %p {port = %p, caller = %@, path = %s%s}"),
+                     session,
+                     CFMachPortGetPort(sessionPrivate->mp),
+                     prefsPrivate->name,
+                     prefsPrivate->newPath ? prefsPrivate->newPath : prefsPrivate->path,
+                     prefsPrivate->locked ? ", locked" : "");
+       }
+
+       pthread_mutex_unlock(&sessionPrivate->lock);
+
+       return;
+}
+
+
+#pragma mark -
 
 
 static const CFRuntimeClass __SCHelperSessionClass = {
@@ -212,12 +344,24 @@ __SCHelperSessionCopyDescription(CFTypeRef cf)
        CFMutableStringRef              result;
        SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)cf;
 
+       pthread_mutex_lock(&sessionPrivate->lock);
+
        result = CFStringCreateMutable(allocator, 0);
        CFStringAppendFormat(result, NULL, CFSTR("<SCHelperSession %p [%p]> {"), cf, allocator);
        CFStringAppendFormat(result, NULL, CFSTR("authorization = %p"), sessionPrivate->authorization);
-       CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), sessionPrivate->prefs);
+       if (sessionPrivate->mp != NULL) {
+               CFStringAppendFormat(result, NULL,
+                                    CFSTR(", mp = %p (port = %p)"),
+                                    sessionPrivate->mp,
+                                    CFMachPortGetPort(sessionPrivate->mp));
+       }
+       if (sessionPrivate->prefs != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", prefs = %@"), sessionPrivate->prefs);
+       }
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
+       pthread_mutex_unlock(&sessionPrivate->lock);
+
        return result;
 }
 
@@ -225,16 +369,24 @@ __SCHelperSessionCopyDescription(CFTypeRef cf)
 static void
 __SCHelperSessionDeallocate(CFTypeRef cf)
 {
-       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)cf;
+       SCHelperSessionRef              session         = (SCHelperSessionRef)cf;
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
+
+       // we're releasing "a" session so take the global lock...
+       pthread_mutex_lock(&sessions_lock);
 
        // release resources
-       __SCHelperSessionSetAuthorization((SCHelperSessionRef)sessionPrivate, NULL);
-       __SCHelperSessionSetPreferences  ((SCHelperSessionRef)sessionPrivate, NULL);
+       __SCHelperSessionSetAuthorization(session, NULL);
+       __SCHelperSessionSetPreferences  (session, NULL);
+       __SCHelperSessionSetVPNFilter    (session, NULL);
+       pthread_mutex_destroy(&sessionPrivate->lock);
 
        // we no longer need/want to track this session
-       pthread_mutex_lock(&sessions_lock);
        CFSetRemoveValue(sessions, sessionPrivate);
+       sessions_generation++;
        sessions_closed++;
+
+       // release the global lock, wake up the main runloop, all done
        pthread_mutex_unlock(&sessions_lock);
        CFRunLoopWakeUp(main_runLoop);
 
@@ -256,10 +408,10 @@ __SCHelperSessionCreate(CFAllocatorRef allocator)
        SCHelperSessionPrivateRef       sessionPrivate;
        uint32_t                        size;
 
-       /* initialize runtime */
+       // initialize runtime
        pthread_once(&initialized, __SCHelperSessionInitialize);
 
-       /* allocate session */
+       // allocate session
        size           = sizeof(SCHelperSessionPrivate) - sizeof(CFRuntimeBase);
        sessionPrivate = (SCHelperSessionPrivateRef)_CFRuntimeCreateInstance(allocator,
                                                                            __kSCHelperSessionTypeID,
@@ -269,25 +421,71 @@ __SCHelperSessionCreate(CFAllocatorRef allocator)
                return NULL;
        }
 
-       sessionPrivate->authorization   = NULL;
-#if    TARGET_OS_IPHONE
-       sessionPrivate->peer_euid       = 0;
-       sessionPrivate->peer_egid       = 0;
-#endif // TARGET_OS_IPHONE
-       sessionPrivate->prefs           = NULL;
+       if (pthread_mutex_init(&sessionPrivate->lock, NULL) != 0) {
+               SCLog(TRUE, LOG_ERR, CFSTR("pthread_mutex_init(): failure to initialize per session lock"));
+               CFRelease(sessionPrivate);
+               return NULL;
+       }
+       sessionPrivate->authorization           = NULL;
+       sessionPrivate->port                    = MACH_PORT_NULL;
+       sessionPrivate->mp                      = NULL;
+       sessionPrivate->callerWriteAccess       = UNKNOWN;
+       sessionPrivate->vpnFilter               = NULL;
+       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
+               const CFSetCallBacks mySetCallBacks = { 0, NULL, NULL, CFCopyDescription, CFEqual, CFHash };
+
+               // create a non-retaining set
+               sessions = CFSetCreateMutable(NULL, 0, &mySetCallBacks);
        }
        CFSetAddValue(sessions, sessionPrivate);
+       sessions_generation++;
        pthread_mutex_unlock(&sessions_lock);
 
        return (SCHelperSessionRef)sessionPrivate;
 }
 
 
+#pragma mark -
+
+
+static SCHelperSessionRef
+__SCHelperSessionFindWithPort(mach_port_t port)
+{
+       SCHelperSessionRef      session = NULL;
+
+       // keep track this session
+       pthread_mutex_lock(&sessions_lock);
+       if (sessions != NULL) {
+               CFIndex         i;
+               CFIndex         n       = CFSetGetCount(sessions);
+               const void *    vals_q[16];
+               const void **   vals    = vals_q;
+
+               if (n > (CFIndex)(sizeof(vals_q) / sizeof(SCHelperSessionRef)))
+                       vals = CFAllocatorAllocate(NULL, n * sizeof(CFStringRef), 0);
+               CFSetGetValues(sessions, vals);
+               for (i = 0; i < n; i++) {
+                       SCHelperSessionPrivateRef       sessionPrivate;
+
+                       sessionPrivate = (SCHelperSessionPrivateRef)vals[i];
+                       if (sessionPrivate->port == port) {
+                               session = (SCHelperSessionRef)sessionPrivate;
+                               break;
+                       }
+               }
+               if (vals != vals_q)
+                       CFAllocatorDeallocate(NULL, vals);
+       }
+       pthread_mutex_unlock(&sessions_lock);
+
+       return session;
+}
+
+
 #pragma mark -
 #pragma mark Helpers
 
@@ -356,6 +554,7 @@ do_Auth(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status
 static Boolean
 do_keychain_copy(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
+       Boolean                 ok              = FALSE;
        SCPreferencesRef        prefs;
        CFStringRef             unique_id       = NULL;
 
@@ -363,18 +562,20 @@ do_keychain_copy(SCHelperSessionRef session, void *info, CFDataRef data, uint32_
                return FALSE;
        }
 
-       if (!isA_CFString(unique_id)) {
-               return FALSE;
-       }
+       if (unique_id != NULL) {
+               if (isA_CFString(unique_id)) {
+                       prefs = __SCHelperSessionGetPreferences(session);
+                       *reply = _SCPreferencesSystemKeychainPasswordItemCopy(prefs, unique_id);
+                       if (*reply == NULL) {
+                               *status = SCError();
+                       }
+                       ok = TRUE;
+               }
 
-       prefs = __SCHelperSessionGetPreferences(session);
-       *reply = _SCPreferencesSystemKeychainPasswordItemCopy(prefs, unique_id);
-       CFRelease(unique_id);
-       if (*reply == NULL) {
-               *status = SCError();
+               CFRelease(unique_id);
        }
 
-       return TRUE;
+       return ok;
 }
 
 
@@ -387,7 +588,7 @@ do_keychain_copy(SCHelperSessionRef session, void *info, CFDataRef data, uint32_
 static Boolean
 do_keychain_exists(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
-       Boolean                 ok;
+       Boolean                 ok              = FALSE;
        SCPreferencesRef        prefs;
        CFStringRef             unique_id       = NULL;
 
@@ -395,19 +596,19 @@ do_keychain_exists(SCHelperSessionRef session, void *info, CFDataRef data, uint3
                return FALSE;
        }
 
-       if (!isA_CFString(unique_id)) {
-               if (unique_id != NULL) CFRelease(unique_id);
-               return FALSE;
-       }
+       if (unique_id != NULL) {
+               if (isA_CFString(unique_id)) {
+                       prefs = __SCHelperSessionGetPreferences(session);
+                       ok = _SCPreferencesSystemKeychainPasswordItemExists(prefs, unique_id);
+                       if (!ok) {
+                               *status = SCError();
+                       }
+               }
 
-       prefs = __SCHelperSessionGetPreferences(session);
-       ok = _SCPreferencesSystemKeychainPasswordItemExists(prefs, unique_id);
-       CFRelease(unique_id);
-       if (!ok) {
-               *status = SCError();
+               CFRelease(unique_id);
        }
 
-       return TRUE;
+       return ok;
 }
 
 
@@ -420,7 +621,7 @@ do_keychain_exists(SCHelperSessionRef session, void *info, CFDataRef data, uint3
 static Boolean
 do_keychain_remove(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
-       Boolean                 ok;
+       Boolean                 ok              = FALSE;
        SCPreferencesRef        prefs;
        CFStringRef             unique_id       = NULL;
 
@@ -428,19 +629,19 @@ do_keychain_remove(SCHelperSessionRef session, void *info, CFDataRef data, uint3
                return FALSE;
        }
 
-       if (!isA_CFString(unique_id)) {
-               if (unique_id != NULL) CFRelease(unique_id);
-               return FALSE;
-       }
+       if (unique_id != NULL) {
+               if (isA_CFString(unique_id)) {
+                       prefs = __SCHelperSessionGetPreferences(session);
+                       ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id);
+                       if (!ok) {
+                               *status = SCError();
+                       }
+               }
 
-       prefs = __SCHelperSessionGetPreferences(session);
-       ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id);
-       CFRelease(unique_id);
-       if (!ok) {
-               *status = SCError();
+               CFRelease(unique_id);
        }
 
-       return TRUE;
+       return ok;
 }
 
 
@@ -467,8 +668,12 @@ do_keychain_set(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t
                return FALSE;
        }
 
-       if (!isA_CFDictionary(options)) {
-               if (options != NULL) CFRelease(options);
+       if (options != NULL) {
+               if (!isA_CFDictionary(options)) {
+                       CFRelease(options);
+                       return FALSE;
+               }
+       } else {
                return FALSE;
        }
 
@@ -541,26 +746,29 @@ static Boolean
 do_interface_refresh(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
        CFStringRef     ifName  = NULL;
-       Boolean         ok;
+       Boolean         ok      = FALSE;
 
        if ((data != NULL) && !_SCUnserializeString(&ifName, data, NULL, 0)) {
                SCLog(TRUE, LOG_ERR, CFSTR("interface name not valid"));
                return FALSE;
        }
 
-       if (!isA_CFString(ifName)) {
-               SCLog(TRUE, LOG_ERR, CFSTR("interface name not valid"));
-               if (ifName != NULL) CFRelease(ifName);
-               return FALSE;
+       if (ifName != NULL) {
+               if (isA_CFString(ifName)) {
+                       ok = _SCNetworkInterfaceForceConfigurationRefresh(ifName);
+                       if (!ok) {
+                               *status = SCError();
+                       }
+               }
+
+               CFRelease(ifName);
        }
 
-       ok = _SCNetworkInterfaceForceConfigurationRefresh(ifName);
-       CFRelease(ifName);
        if (!ok) {
-               *status = SCError();
+               SCLog(TRUE, LOG_ERR, CFSTR("interface name not valid"));
        }
 
-       return TRUE;
+       return ok;
 }
 
 
@@ -574,11 +782,13 @@ static Boolean
 do_prefs_Open(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
        CFStringRef             name;
+       CFDictionaryRef         options;
        CFNumberRef             pid;
        SCPreferencesRef        prefs           = __SCHelperSessionGetPreferences(session);
        CFDictionaryRef         prefsInfo       = NULL;
        CFStringRef             prefsID;
        CFStringRef             prefsName;
+       CFStringRef             proc_name;
 
        if (prefs != NULL) {
                return FALSE;
@@ -611,6 +821,10 @@ do_prefs_Open(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *
                }
        }
 
+       // get [optional] options
+       options = CFDictionaryGetValue(prefsInfo, CFSTR("options"));
+       options = isA_CFDictionary(options);
+
        // get preferences session "name"
        name = CFDictionaryGetValue(prefsInfo, CFSTR("name"));
        if (!isA_CFString(name)) {
@@ -627,15 +841,42 @@ do_prefs_Open(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *
                return FALSE;
        }
 
+       // get process name of caller
+       proc_name = CFDictionaryGetValue(prefsInfo, CFSTR("PROC_NAME"));
+       if (!isA_CFString(proc_name)) {
+               SCLog(TRUE, LOG_ERR, CFSTR("process name 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);
+       prefsName = CFStringCreateWithFormat(NULL, NULL,
+                                            CFSTR("%@(%@):%@"),
+                                            proc_name,
+                                            pid,
+                                            name);
+
+       prefs = SCPreferencesCreateWithOptions(NULL, prefsName, prefsID, NULL, options);
        CFRelease(prefsName);
        CFRelease(prefsInfo);
 
        __SCHelperSessionSetPreferences(session, prefs);
+
        if (prefs != NULL) {
+#ifdef NOTYET
+               Boolean ok;
+               CFRunLoopRef    rl      = CFRunLoopGetCurrent();
+
+               // [temporarily] schedule notifications to ensure that we can use
+               // the SCDynamicStore to track helper sessions
+               ok = SCPreferencesScheduleWithRunLoop(prefs, rl, kCFRunLoopDefaultMode);
+               if (ok) {
+                       (void)SCPreferencesUnscheduleFromRunLoop(prefs, rl, kCFRunLoopDefaultMode);
+               }
+#endif // NOTYET
+
+               // the session now holds a references to the SCPreferencesRef
                CFRelease(prefs);
        } else {
                *status = SCError();
@@ -743,24 +984,118 @@ static Boolean
 do_prefs_Commit(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
        Boolean                 ok;
-       SCPreferencesRef        prefs   = __SCHelperSessionGetPreferences(session);
+       SCPreferencesRef        prefs           = __SCHelperSessionGetPreferences(session);
+       CFPropertyListRef       prefsData       = NULL;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       CFArrayRef              vpnFilter;
 
        if (prefs == NULL) {
                return FALSE;
        }
 
        if (data != NULL) {
-               SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+               ok = _SCUnserialize(&prefsData, data, NULL, 0);
+               if (!ok) {
+                       return FALSE;
+               }
 
-               if (prefsPrivate->prefs != NULL) {
-                       CFRelease(prefsPrivate->prefs);
+               if (!isA_CFDictionary(prefsData)) {
+                       *status = kSCStatusFailed;
+                       ok = FALSE;
+                       goto done;
+               }
+       }
+
+       vpnFilter = __SCHelperSessionGetVPNFilter(session);
+       if (vpnFilter != NULL) {
+               ok = FALSE;
+
+               if ((prefsPrivate->prefs != NULL) && (prefsData != NULL)) {
+                       CFIndex                 c;
+                       CFMutableDictionaryRef  prefsNew        = NULL;
+                       CFMutableDictionaryRef  prefsOld        = NULL;
+                       CFMutableDictionaryRef  prefsSave       = prefsPrivate->prefs;
+                       CFRange                 range           = CFRangeMake(0, CFArrayGetCount(vpnFilter));
+
+                       for (c = 0; c < 2; c++) {
+                               CFArrayRef      services;
+
+                               switch (c) {
+                                       case 0 :
+                                               prefsPrivate->prefs = CFDictionaryCreateMutableCopy(NULL, 0, prefsSave);
+                                               break;
+                                       case 1 :
+                                               prefsPrivate->prefs = CFDictionaryCreateMutableCopy(NULL, 0, prefsData);
+                                               break;
+                               }
+
+                               // filter out VPN services of the specified type
+                               services = SCNetworkServiceCopyAll(prefs);
+                               if (services != NULL) {
+                                       CFIndex i;
+                                       CFIndex n       = CFArrayGetCount(services);
+
+                                       for (i = 0; i < n; i++) {
+                                               SCNetworkServiceRef     service;
+
+                                               service = CFArrayGetValueAtIndex(services, i);
+                                               if (_SCNetworkServiceIsVPN(service)) {
+                                                       SCNetworkInterfaceRef   child;
+                                                       CFStringRef             childType       = NULL;
+                                                       SCNetworkInterfaceRef   interface;
+                                                       CFStringRef             interfaceType;
+
+                                                       interface     = SCNetworkServiceGetInterface(service);
+                                                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                                                       child         = SCNetworkInterfaceGetInterface(interface);
+                                                       if (child != NULL) {
+                                                               childType = SCNetworkInterfaceGetInterfaceType(child);
+                                                       }
+                                                       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVPN) &&
+                                                           (childType != NULL) &&
+                                                           CFArrayContainsValue(vpnFilter, range, childType)) {
+                                                               // filter out VPN service
+                                                               (void) SCNetworkServiceRemove(service);
+                                                       } else {
+                                                               // mark all other VPN services "enabled"
+                                                               (void) SCNetworkServiceSetEnabled(service, TRUE);
+                                                       }
+                                               }
+                                       }
+
+                                       CFRelease(services);
+                               }
+
+                               switch (c) {
+                                       case 0 :
+                                               prefsOld = prefsPrivate->prefs;
+                                               break;
+                                       case 1 :
+                                               prefsNew = prefsPrivate->prefs;
+                                               break;
+                               }
+                       }
+
+                       // compare the filtered configurations
+                       ok = _SC_CFEqual(prefsOld, prefsNew);
+
+                       // clean up
+                       if (prefsOld != NULL) CFRelease(prefsOld);
+                       if (prefsNew != NULL) CFRelease(prefsNew);
+                       prefsPrivate->prefs = prefsSave;
                }
 
-               ok = _SCUnserialize((CFPropertyListRef *)&prefsPrivate->prefs, data, NULL, 0);
                if (!ok) {
-                       return FALSE;
+                       *status = kSCStatusAccessError;
+                       goto done;
                }
+       }
 
+       if (prefsData != NULL) {
+               if (prefsPrivate->prefs != NULL) {
+                       CFRelease(prefsPrivate->prefs);
+               }
+               prefsPrivate->prefs    = CFDictionaryCreateMutableCopy(NULL, 0, prefsData);
                prefsPrivate->accessed = TRUE;
                prefsPrivate->changed  = TRUE;
        }
@@ -773,7 +1108,10 @@ do_prefs_Commit(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t
                *status = SCError();
        }
 
-       return TRUE;
+    done :
+
+       if (prefsData != NULL) CFRelease(prefsData);
+       return ok;
 }
 
 
@@ -873,21 +1211,87 @@ do_prefs_Synchronize(SCHelperSessionRef session, void *info, CFDataRef data, uin
 #pragma mark Process commands
 
 
+#if    TARGET_OS_IPHONE
+
+#include <Security/Security.h>
+#include <Security/SecTask.h>
+
+static CFStringRef
+sessionName(SCHelperSessionRef session)
+{
+       CFStringRef             name    = NULL;
+       SCPreferencesRef        prefs;
+
+       prefs = __SCHelperSessionGetPreferences(session);
+       if (prefs != NULL) {
+               SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+
+               name = prefsPrivate->name;
+       }
+
+       return (name != NULL) ? name : CFSTR("???");
+}
+
+
+static CFTypeRef
+copyEntitlement(SCHelperSessionRef session, CFStringRef entitlement)
+{
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
+       SecTaskRef                      task;
+       CFTypeRef                       value           = NULL;
+
+       // Create the security task from the audit token
+       task = SecTaskCreateWithAuditToken(NULL, sessionPrivate->auditToken);
+       if (task != NULL) {
+               CFErrorRef      error   = NULL;
+
+               // Get the value for the entitlement
+               value = SecTaskCopyValueForEntitlement(task, entitlement, &error);
+               if ((value == NULL) && (error != NULL)) {
+                       CFIndex         code    = CFErrorGetCode(error);
+                       CFStringRef     domain  = CFErrorGetDomain(error);
+
+                       if (!CFEqual(domain, kCFErrorDomainMach) || (code != kIOReturnNotFound)) {
+                               // if unexpected error
+                               SCLog(TRUE, LOG_ERR,
+                                     CFSTR("SecTaskCopyValueForEntitlement(,\"%@\",) failed, error = %@ : %@"),
+                                     entitlement,
+                                     error,
+                                     sessionName(session));
+                       }
+                       CFRelease(error);
+               }
+
+               CFRelease(task);
+       } else {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SecTaskCreateWithAuditToken() failed: %@"),
+                     sessionName(session));
+       }
+
+       return value;
+}
+
+#endif // TARGET_OS_IPHONE
+
+
+
+
 static Boolean
 hasAuthorization(SCHelperSessionRef session)
 {
        AuthorizationRef        authorization   = __SCHelperSessionGetAuthorization(session);
 
+       if (authorization == NULL) {
+               return FALSE;
+       }
+
 #if    !TARGET_OS_IPHONE
        AuthorizationFlags      flags;
        AuthorizationItem       items[1];
        AuthorizationRights     rights;
        OSStatus                status;
 
-       if (authorization == NULL) {
-               return FALSE;
-       }
-
        items[0].name        = "system.preferences";
        items[0].value       = NULL;
        items[0].valueLength = 0;
@@ -910,41 +1314,85 @@ hasAuthorization(SCHelperSessionRef session)
        if (status != errAuthorizationSuccess) {
                return FALSE;
        }
-#else  // !TARGET_OS_IPHONE
-       uid_t   peer_euid;
-       gid_t   peer_egid;
 
-       if (authorization == NULL) {
-               return FALSE;
-       }
+       return TRUE;
+#else  // !TARGET_OS_IPHONE
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
 
-       __SCHelperSessionGetCredentials(session, &peer_euid, &peer_egid);
-       if ((peer_euid != 0) && (peer_egid != 0)) {
-               static gid_t    mobile_gid      = -1;
+       if (sessionPrivate->callerWriteAccess == UNKNOWN) {
+               CFArrayRef              entitlement;
+               CFStringRef             prefsID;
+               SCPreferencesPrivateRef prefsPrivate;
+
+               // assume that the client DOES NOT have the entitlement
+               sessionPrivate->callerWriteAccess = NO;
+
+               prefsPrivate = (SCPreferencesPrivateRef)sessionPrivate->prefs;
+               prefsID      = (prefsPrivate->prefsID != NULL) ? prefsPrivate->prefsID : PREFS_DEFAULT_CONFIG;
+
+               entitlement = copyEntitlement(session, kSCWriteEntitlementName);
+               if (entitlement != NULL) {
+                       if (isA_CFArray(entitlement)) {
+                               if (CFArrayContainsValue(entitlement,
+                                                        CFRangeMake(0, CFArrayGetCount(entitlement)),
+                                                        prefsID)) {
+                                       // if client DOES have entitlement
+                                       sessionPrivate->callerWriteAccess = YES;
+                               }
+                       } else {
+                               SCLog(TRUE, LOG_ERR,
+                                     CFSTR("hasAuthorization: entitlement not valid: %@"),
+                                     sessionName(session));
+                       }
 
-               /*
-                * 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;
+                       CFRelease(entitlement);
+               }
 
-                       if (getgrnam_r("mobile", &grp, buffer, sizeof(buffer), &grpP) == 0) {
-                               mobile_gid = grpP->gr_gid;
+               // make an exception for VPN configuration management
+               if (sessionPrivate->callerWriteAccess != YES) {
+                       entitlement = copyEntitlement(session, kSCVPNFilterEntitlementName);
+                       if (entitlement != NULL) {
+                               if (isA_CFArray(entitlement)) {
+                                       if (CFEqual(prefsID, PREFS_DEFAULT_CONFIG)) {
+                                               // save the VPN bundle identifiers
+                                               __SCHelperSessionSetVPNFilter(session, entitlement);
+
+                                               // and grant a "filtered" exception
+                                               sessionPrivate->callerWriteAccess = YES;
+                                       } else if (CFStringHasPrefix(prefsID, CFSTR("VPN-")) &&
+                                                  CFStringHasSuffix(prefsID, CFSTR(".plist"))) {
+                                               CFRange         range;
+                                               CFStringRef     vpnID;
+
+                                               range.location = sizeof("VPN-") - 1;
+                                               range.length   = CFStringGetLength(prefsID)
+                                                                - (sizeof("VPN-") - 1)         // trim VPN-
+                                                                - (sizeof(".plist") - 1);      // trim .plist
+                                               vpnID = CFStringCreateWithSubstring(NULL, prefsID, range);
+                                               if (CFArrayContainsValue(entitlement,
+                                                                        CFRangeMake(0, CFArrayGetCount(entitlement)),
+                                                                        vpnID)) {
+                                                       // grant an exception
+                                                       sessionPrivate->callerWriteAccess = YES;
+                                               }
+                                               CFRelease(vpnID);
+                                       }
+                               }
+
+                               CFRelease(entitlement);
                        }
                }
 
-               if (peer_egid != mobile_gid) {
-                       return FALSE;
+               if (sessionPrivate->callerWriteAccess != YES) {
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("SCPreferences write access to \"%@\" denied, no entitlement for \"%@\""),
+                             prefsID,
+                             sessionName(session));
                }
        }
-#endif // !TARGET_OS_IPHONE
 
-//     if (items[0].flags != 0) SCLog(TRUE, LOG_DEBUG, CFSTR("***** success w/flags (%u) != 0"), items[0].flags);
-       return TRUE;
+       return (sessionPrivate->callerWriteAccess == YES) ? TRUE : FALSE;
+#endif // TARGET_OS_IPHONE
 }
 
 
@@ -989,7 +1437,7 @@ static const struct helper {
 
 
 static int
-findHelper(uint32_t command)
+findCommand(uint32_t command)
 {
        int     i;
 
@@ -1003,187 +1451,506 @@ findHelper(uint32_t command)
 }
 
 
-static Boolean
-process_command(SCHelperSessionRef session, int fd, int *err)
+static void *
+newHelper(void *arg)
 {
-       uint32_t        command = 0;
-       CFDataRef       data    = NULL;
-       int             i;
-       Boolean         ok      = FALSE;
-       CFDataRef       reply   = NULL;
-       uint32_t        status  = kSCStatusOK;
+       CFRunLoopSourceRef              rls             = NULL;
+       SCHelperSessionRef              session         = (SCHelperSessionRef)arg;
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
 
-       if (!__SCHelper_rxMessage(fd, &command, &data)) {
-               SCLog(TRUE, LOG_ERR, CFSTR("no command"));
-               *err = EIO;
-               goto done;
-       }
+       __SCHelperSessionSetThreadName(session);
 
-       i = findHelper(command);
-       if (i == -1) {
-               SCLog(TRUE, LOG_ERR, CFSTR("received unknown command : %u"), command);
-               *err = EINVAL;
-               goto done;
-       }
+       rls = CFMachPortCreateRunLoopSource(NULL, sessionPrivate->mp, 0);
+       CFRelease(sessionPrivate->mp);
 
-       SCLog(debug, LOG_DEBUG,
-             CFSTR("processing command \"%s\"%s"),
-             helpers[i].commandName,
-             (data != NULL) ? " w/data" : "");
+       if (rls != NULL) {
+               CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+               CFRelease(rls);
 
-       if (helpers[i].needsAuthorization && !hasAuthorization(session)) {
-               SCLog(debug, LOG_DEBUG,
-                     CFSTR("command \"%s\" : not authorized"),
-                     helpers[i].commandName);
-               status = kSCStatusAccessError;
+               SCLog(debug, LOG_DEBUG, CFSTR("%p : start"), session);
+               CFRunLoopRun();
+               SCLog(debug, LOG_DEBUG, CFSTR("%p : stop"), session);
        }
 
-       if (status == kSCStatusOK) {
-               ok = (*helpers[i].func)(session, helpers[i].info, data, &status, &reply);
+       return NULL;
+}
+
+
+#pragma mark -
+#pragma mark Main loop
+
+
+// MiG generated externals and functions
+extern struct mig_subsystem    _helper_subsystem;
+extern boolean_t               helper_server(mach_msg_header_t *, mach_msg_header_t *);
+
+
+static
+boolean_t
+notify_server(mach_msg_header_t *request, mach_msg_header_t *reply)
+{
+       mach_no_senders_notification_t  *Request = (mach_no_senders_notification_t *)request;
+       mig_reply_error_t               *Reply   = (mig_reply_error_t *)reply;
+
+       reply->msgh_bits        = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request->msgh_bits), 0);
+       reply->msgh_remote_port = request->msgh_remote_port;
+       reply->msgh_size        = sizeof(mig_reply_error_t);    /* Minimal size: update as needed */
+       reply->msgh_local_port  = MACH_PORT_NULL;
+       reply->msgh_id          = request->msgh_id + 100;
+
+       if ((Request->not_header.msgh_id > MACH_NOTIFY_LAST) ||
+           (Request->not_header.msgh_id < MACH_NOTIFY_FIRST)) {
+               Reply->NDR     = NDR_record;
+               Reply->RetCode = MIG_BAD_ID;
+               return FALSE;   /* if this is not a notification message */
        }
 
-       if ((status != -1) || (reply != NULL)) {
-               SCLog(debug, LOG_DEBUG,
-                     CFSTR("sending status %u%s"),
-                     status,
-                     (reply != NULL) ? " w/reply" : "");
+       switch (Request->not_header.msgh_id) {
+               case MACH_NOTIFY_NO_SENDERS : {
+                       SCHelperSessionRef              session;
 
-               if (!__SCHelper_txMessage(fd, status, reply)) {
-                       *err = EIO;
-                       ok = FALSE;
-                       goto done;
+                       __MACH_PORT_DEBUG(TRUE, "*** notify_server MACH_NOTIFY_NO_SENDERS", Request->not_header.msgh_local_port);
+
+                       // clean up session
+                       session = __SCHelperSessionFindWithPort(Request->not_header.msgh_local_port);
+                       if (session != NULL) {
+                               SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
+
+                               // release CFMachPort *and* SCHelperSession
+                               CFMachPortInvalidate(sessionPrivate->mp);
+                       }
+
+                       __MACH_PORT_DEBUG(TRUE, "*** notify_server after invalidate", Request->not_header.msgh_local_port);
+
+                       // and, lastly, remove our receive right.
+                       (void) mach_port_mod_refs(mach_task_self(),
+                                                 Request->not_header.msgh_local_port,
+                                                 MACH_PORT_RIGHT_RECEIVE, -1);
+
+                       Reply->Head.msgh_bits           = 0;
+                       Reply->Head.msgh_remote_port    = MACH_PORT_NULL;
+                       Reply->RetCode                  = KERN_SUCCESS;
+                       return TRUE;
                }
+
+               default :
+                       break;
        }
 
-    done :
+       SCLog(TRUE, LOG_ERR, CFSTR("HELP!, Received notification: port=%d, msgh_id=%d"),
+             Request->not_header.msgh_local_port,
+             Request->not_header.msgh_id);
 
-       if (data != NULL) {
-               CFRelease(data);
+       Reply->NDR     = NDR_record;
+       Reply->RetCode = MIG_BAD_ID;
+       return FALSE;   /* if this is not a notification we are handling */
+}
+
+
+__private_extern__
+boolean_t
+helper_demux(mach_msg_header_t *request, mach_msg_header_t *reply)
+{
+       Boolean                         processed = FALSE;
+
+       /*
+        * (attempt to) process SCHelper requests.
+        */
+       processed = helper_server(request, reply);
+       if (processed) {
+               return TRUE;
        }
 
-       if (reply != NULL) {
-               CFRelease(reply);
+       /*
+        * (attempt to) process (NO MORE SENDERS) notification messages.
+        */
+       processed = notify_server(request, reply);
+       if (processed) {
+               return TRUE;
        }
 
-       return ok;
+       /*
+        * unknown message ID, log and return an error.
+        */
+       SCLog(TRUE, LOG_ERR, CFSTR("helper_demux(): unknown message ID (%d) received"), request->msgh_id);
+       reply->msgh_bits        = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request->msgh_bits), 0);
+       reply->msgh_remote_port = request->msgh_remote_port;
+       reply->msgh_size        = sizeof(mig_reply_error_t);    /* Minimal size */
+       reply->msgh_local_port  = MACH_PORT_NULL;
+       reply->msgh_id          = request->msgh_id + 100;
+       ((mig_reply_error_t *)reply)->NDR = NDR_record;
+       ((mig_reply_error_t *)reply)->RetCode = MIG_BAD_ID;
+
+       return FALSE;
 }
 
 
-#pragma mark -
-#pragma mark Main loop
+#define        MACH_MSG_BUFFER_SIZE    128
 
 
 static void
-readCallback(CFSocketRef               s,
-            CFSocketCallBackType       callbackType,
-            CFDataRef                  address,
-            const void                 *data,
-            void                       *info)
+helperCallback(CFMachPortRef port, void *msg, CFIndex size, 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;
+       mig_reply_error_t *     bufRequest      = msg;
+       uint32_t                bufReply_q[MACH_MSG_BUFFER_SIZE/sizeof(uint32_t)];
+       mig_reply_error_t *     bufReply        = (mig_reply_error_t *)bufReply_q;
+       static CFIndex          bufSize         = 0;
+       mach_msg_return_t       mr;
+       int                     options;
+
+       if (bufSize == 0) {
+               // get max size for MiG reply buffers
+               bufSize = _helper_subsystem.maxsize;
+
+               // check if our on-the-stack reply buffer will be big enough
+               if (bufSize > sizeof(bufReply_q)) {
+                       SCLog(TRUE, LOG_NOTICE,
+                             CFSTR("helperCallback(): buffer size should be increased > %d"),
+                             _helper_subsystem.maxsize);
+               }
        }
 
-       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);
+       if (bufSize > sizeof(bufReply_q)) {
+               bufReply = CFAllocatorAllocate(NULL, _helper_subsystem.maxsize, 0);
        }
+       bufReply->RetCode = 0;
 
-       return;
-}
+       /* we have a request message */
+       (void) helper_demux(&bufRequest->Head, &bufReply->Head);
 
+       if (!(bufReply->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) {
+               if (bufReply->RetCode == MIG_NO_REPLY) {
+                       bufReply->Head.msgh_remote_port = MACH_PORT_NULL;
+               } else if ((bufReply->RetCode != KERN_SUCCESS) &&
+                          (bufRequest->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) {
+                       /*
+                        * destroy the request - but not the reply port
+                        */
+                       bufRequest->Head.msgh_remote_port = MACH_PORT_NULL;
+                       mach_msg_destroy(&bufRequest->Head);
+               }
+       }
 
-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 (bufReply->Head.msgh_remote_port != MACH_PORT_NULL) {
+               /*
+                * send reply.
+                *
+                * We don't want to block indefinitely because the client
+                * isn't receiving messages from the reply port.
+                * If we have a send-once right for the reply port, then
+                * this isn't a concern because the send won't block.
+                * If we have a send right, we need to use MACH_SEND_TIMEOUT.
+                * To avoid falling off the kernel's fast RPC path unnecessarily,
+                * we only supply MACH_SEND_TIMEOUT when absolutely necessary.
+                */
 
-#if    TARGET_OS_IPHONE
-       uid_t                   peer_euid;
-       gid_t                   peer_egid;
-#endif // TARGET_OS_IPHONE
+               options = MACH_SEND_MSG;
+               if (MACH_MSGH_BITS_REMOTE(bufReply->Head.msgh_bits) != MACH_MSG_TYPE_MOVE_SEND_ONCE) {
+                       options |= MACH_SEND_TIMEOUT;
+               }
+               mr = mach_msg(&bufReply->Head,          /* msg */
+                             options,                  /* option */
+                             bufReply->Head.msgh_size, /* send_size */
+                             0,                        /* rcv_size */
+                             MACH_PORT_NULL,           /* rcv_name */
+                             MACH_MSG_TIMEOUT_NONE,    /* timeout */
+                             MACH_PORT_NULL);          /* notify */
+
+               /* Has a message error occurred? */
+               switch (mr) {
+                       case MACH_SEND_INVALID_DEST:
+                       case MACH_SEND_TIMED_OUT:
+                               break;
+                       default :
+                               /* Includes success case.  */
+                               goto done;
+               }
+       }
 
-       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));
+       if (bufReply->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) {
+               mach_msg_destroy(&bufReply->Head);
        }
-#endif // TARGET_OS_IPHONE
 
-       context.info = (void *)session;
-       sock = CFSocketCreateWithNative(NULL,
-                                       fd,
-                                       kCFSocketReadCallBack,
-                                       readCallback,
-                                       &context);
-       CFRelease(session);
+       done :
 
-       rls = CFSocketCreateRunLoopSource(NULL, sock, 0);
-       CFRelease(sock);
+       if (bufReply != (mig_reply_error_t *)bufReply_q)
+               CFAllocatorDeallocate(NULL, bufReply);
+       return;
+}
 
-       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
-       CFRelease(rls);
 
-       CFRunLoopRun();
-       return NULL;
+static CFStringRef
+initMPCopyDescription(const void *info)
+{
+       return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SCHelper MP>"));
 }
 
 
-static void
-acceptCallback(CFSocketRef             s,
-              CFSocketCallBackType     callbackType,
-              CFDataRef                address,
-              const void               *data,
-              void                     *info)
+__private_extern__
+kern_return_t
+_helperinit(mach_port_t                        server,
+           mach_port_t                 *newSession,
+           uint32_t                    *status,
+           audit_token_t               audit_token)
 {
-       CFSocketNativeHandle    fd;
-       pthread_attr_t          tattr;
-       pthread_t               tid;
-       static int              yes     = 1;
+       CFMachPortContext               context         = { 0
+                                                         , NULL
+                                                         , CFRetain
+                                                         , CFRelease
+                                                         , initMPCopyDescription
+                                                         };
+       kern_return_t                   kr;
+       mach_port_t                     oldNotify;
+       SCHelperSessionRef              session;
+       SCHelperSessionPrivateRef       sessionPrivate;
+       pthread_attr_t                  tattr;
+       pthread_t                       tid;
 
-       if (callbackType != kCFSocketAcceptCallBack) {
-               SCLog(TRUE, LOG_ERR, CFSTR("acceptCallback w/callbackType = %d"), callbackType);
-               return;
+       session = __SCHelperSessionFindWithPort(server);
+       if (session != NULL) {
+#ifdef DEBUG
+               SCLog(TRUE, LOG_DEBUG, CFSTR("_helperinit(): session is already open."));
+#endif /* DEBUG */
+               *status = kSCStatusFailed;      /* you can't re-open an "open" session */
+               return KERN_SUCCESS;
        }
 
-       if ((data == NULL) ||
-           ((fd = *((CFSocketNativeHandle *)data)) == -1)) {
-               SCLog(TRUE, LOG_ERR, CFSTR("accept w/no FD"));
-               return;
+       session = __SCHelperSessionCreate(NULL);
+       sessionPrivate = (SCHelperSessionPrivateRef)session;
+
+       // create per-session port
+       (void) mach_port_allocate(mach_task_self(),
+                                 MACH_PORT_RIGHT_RECEIVE,
+                                 &sessionPrivate->port);
+       *newSession = sessionPrivate->port;
+
+       //
+       // Note: we create the CFMachPort *before* we insert a send
+       //       right present to ensure that CF does not establish
+       //       its dead name notification.
+       //
+       context.info = (void *)session;
+       sessionPrivate->mp = _SC_CFMachPortCreateWithPort("SCHelper/session",
+                                                         *newSession,
+                                                         helperCallback,
+                                                         &context);
+
+       /* Request a notification when/if the client dies */
+       kr = mach_port_request_notification(mach_task_self(),
+                                           *newSession,
+                                           MACH_NOTIFY_NO_SENDERS,
+                                           1,
+                                           *newSession,
+                                           MACH_MSG_TYPE_MAKE_SEND_ONCE,
+                                           &oldNotify);
+       if (kr != KERN_SUCCESS) {
+               SCLog(TRUE, LOG_ERR, CFSTR("_helperinit() mach_port_request_notification() failed: %s"), mach_error_string(kr));
+
+               // clean up CFMachPort, mach port rights
+               CFMachPortInvalidate(sessionPrivate->mp);
+               CFRelease(sessionPrivate->mp);
+               sessionPrivate->mp = NULL;
+               (void) mach_port_mod_refs(mach_task_self(), *newSession, MACH_PORT_RIGHT_RECEIVE, -1);
+               *newSession = MACH_PORT_NULL;
+               *status = kSCStatusFailed;
+               goto done;
        }
 
-       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;
+       if (oldNotify != MACH_PORT_NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("_helperinit(): oldNotify != MACH_PORT_NULL"));
        }
 
+       // add send right (that will be passed back to the client)
+       (void) mach_port_insert_right(mach_task_self(),
+                                     *newSession,
+                                     *newSession,
+                                     MACH_MSG_TYPE_MAKE_SEND);
+
+       // save audit token
+       sessionPrivate->auditToken = audit_token;
+
+       //
+       // 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.
+       //
+
        // 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_create(&tid, &tattr, newHelper, (void *)session);
        pthread_attr_destroy(&tattr);
 
+       *status = kSCStatusOK;
+
+    done :
+
+       CFRelease(session);
+       return KERN_SUCCESS;
+}
+
+
+__private_extern__
+kern_return_t
+_helperexec(mach_port_t                        server,
+           uint32_t                    msgID,
+           xmlData_t                   dataRef,        /* raw XML bytes */
+           mach_msg_type_number_t      dataLen,
+           uint32_t                    *status,
+           xmlDataOut_t                *replyRef,      /* raw XML bytes */
+           mach_msg_type_number_t      *replyLen)
+{
+       CFDataRef                       data    = NULL;
+       int                             i;
+       CFDataRef                       reply   = NULL;
+       SCHelperSessionRef              session;
+
+       *status   = kSCStatusOK;
+       *replyRef = NULL;
+       *replyLen = 0;
+
+       if ((dataRef != NULL) && (dataLen > 0)) {
+               if (!_SCUnserializeData(&data, (void *)dataRef, dataLen)) {
+                       *status = SCError();
+                       return KERN_SUCCESS;
+               }
+       }
+
+       session = __SCHelperSessionFindWithPort(server);
+       if (session == NULL) {
+               *status = kSCStatusFailed;      /* you must have an open session to play */
+               goto done;
+       }
+
+       i = findCommand(msgID);
+       if (i == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("received unknown command : %u"), msgID);
+               *status = kSCStatusInvalidArgument;
+               goto done;
+       }
+
+       SCLog(debug, LOG_DEBUG,
+             CFSTR("%p : processing command \"%s\"%s"),
+             session,
+             helpers[i].commandName,
+             (data != NULL) ? " w/data" : "");
+
+       if (helpers[i].needsAuthorization && !hasAuthorization(session)) {
+               SCLog(debug, LOG_DEBUG,
+                     CFSTR("%p : command \"%s\" : not authorized"),
+                     session,
+                     helpers[i].commandName);
+               *status = kSCStatusAccessError;
+       }
+
+       if (*status == kSCStatusOK) {
+               (*helpers[i].func)(session, helpers[i].info, data, status, &reply);
+       }
+
+       if ((*status != -1) || (reply != NULL)) {
+               Boolean ok;
+
+               SCLog(debug, LOG_DEBUG,
+                     CFSTR("%p : sending status %u%s"),
+                     session,
+                     *status,
+                     (reply != NULL) ? " w/reply" : "");
+
+               /* serialize the data */
+               if (reply != NULL) {
+                       ok = _SCSerializeData(reply, (void **)replyRef, (CFIndex *)replyLen);
+                       CFRelease(reply);
+                       reply = NULL;
+                       if (!ok) {
+                               *status = SCError();
+                               goto done;
+                       }
+               }
+       }
+
+    done :
+
+       if (data  != NULL) CFRelease(data);
+       if (reply != NULL) CFRelease(reply);
+       return KERN_SUCCESS;
+}
+
+
+static CFStringRef
+helperMPCopyDescription(const void *info)
+{
+       return CFStringCreateWithFormat(NULL, NULL, CFSTR("<main SCHelper MP>"));
+}
+
+
+static void
+init_MiG_1(const launch_data_t l_obj, const char *name, void *info)
+{
+       CFMachPortContext       context         = { 0
+                                                 , (void *)1
+                                                 , NULL
+                                                 , NULL
+                                                 , helperMPCopyDescription
+                                                 };
+       launch_data_type_t      l_type;
+       CFMachPortRef           mp;
+       int                     *n_listeners    = (int *)info;
+       CFRunLoopSourceRef      rls;
+       mach_port_t             service_port;
+
+       // get the mach port
+       l_type = (l_obj != NULL) ? launch_data_get_type(l_obj) : 0;
+       if (l_type != LAUNCH_DATA_MACHPORT) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCHelper: error w/MachServices \"%s\" port (%p, %d)"),
+                     (name != NULL) ? name : "?",
+                     l_obj,
+                     l_type);
+               return;
+       }
+       service_port = launch_data_get_machport(l_obj);
+
+       // add a run loop source to listen for new requests
+       mp = _SC_CFMachPortCreateWithPort("SCHelper/server",
+                                         service_port,
+                                         helperCallback,
+                                         &context);
+       rls = CFMachPortCreateRunLoopSource(NULL, mp, 0);
+       CFRelease(mp);
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       *n_listeners = *n_listeners + 1;
+
        return;
 }
 
 
-#include <launch.h>
+static int
+init_MiG(launch_data_t l_reply, int *n_listeners)
+{
+       launch_data_t           l_machservices;
+       launch_data_type_t      l_type;
+
+       l_machservices = launch_data_dict_lookup(l_reply, LAUNCH_JOBKEY_MACHSERVICES);
+       l_type = (l_machservices != NULL) ? launch_data_get_type(l_machservices) : 0;
+       if (l_type != LAUNCH_DATA_DICTIONARY) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCHelper: error w/" LAUNCH_JOBKEY_MACHSERVICES " (%p, %d)"),
+                     l_machservices,
+                     l_type);
+               return 1;
+       }
+
+       launch_data_dict_iterate(l_machservices, init_MiG_1, (void *)n_listeners);
+       return 0;
+}
+
+
+#pragma mark -
+#pragma mark Main
 
 
 static const struct option longopts[] = {
@@ -1195,15 +1962,14 @@ static const struct option longopts[] = {
 int
 main(int argc, char **argv)
 {
-       Boolean                 done    = FALSE;
-       int                     err     = 0;
-       int                     i;
-       launch_data_t           l_listeners;
+       Boolean                 done            = FALSE;
+       int                     err             = 0;
+       int                     gen_reported    = 0;
+       int                     idle            = 0;
        launch_data_t           l_msg;
        launch_data_t           l_reply;
-       launch_data_t           l_sockets;
        launch_data_type_t      l_type;
-       int                     n       = 0;
+       int                     n_listeners     = 0;
        extern int              optind;
        int                     opt;
        int                     opti;
@@ -1250,76 +2016,55 @@ main(int argc, char **argv)
                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);
+       err = init_MiG(l_reply, &n_listeners);
+       if (err != 0) {
                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);
-       }
-
     done :
 
        if (l_reply != NULL) launch_data_free(l_reply);
 
-       if ((err != 0) || (n == 0)) {
+       if ((err != 0) || (n_listeners == 0)) {
                exit(err);
        }
 
+       pthread_setname_np("SCHelper main thread");
+
        while (!done) {
                SInt32  rlStatus;
+               int     gen_current;
 
                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);
+
+               pthread_mutex_lock(&sessions_lock);
+
+               if (sessions != NULL) {
+                       if (rlStatus == kCFRunLoopRunTimedOut) {
+                               idle++;
+
+                               if ((CFSetGetCount(sessions) == 0) && (sessions_closed == 0)) {
+                                       // if we don't have any open sessions and no
+                                       // sessions have recently been closed
+                                       done = TRUE;
+                               }
+                       } else {
+                               idle = 0;
+                       }
                }
+               gen_current = sessions_generation;
+               sessions_closed = 0;
+
+               if (!done && (idle >= (2 * 60 / 15))) {
+                       if (gen_reported != gen_current) {
+                               SCLog(TRUE, LOG_NOTICE, CFSTR("active (but IDLE) sessions"));
+                               CFSetApplyFunction(sessions, __SCHelperSessionLog, NULL);
+                               gen_reported = gen_current;
+                       }
+                       idle = 0;
+               }
+
+               pthread_mutex_unlock(&sessions_lock);
        }
 
        exit(EX_OK);
index 023d9b488824f680851569d693088359681f11f1..abf809552cd0d578fa4c357805df8a93fcb24db2 100644 (file)
@@ -6,17 +6,10 @@
        <string>com.apple.SCHelper</string>
        <key>Program</key>
        <string>/System/Library/Frameworks/SystemConfiguration.framework/SCHelper</string>
-       <key>Sockets</key>
+       <key>MachServices</key>
        <dict>
-               <key>Listeners</key>
-               <dict>
-                       <key>SockFamily</key>
-                       <string>Unix</string>
-                       <key>SockPathMode</key>
-                       <integer>438</integer>
-                       <key>SockPathName</key>
-                       <string>/var/run/SCHelper</string>
-               </dict>
+               <key>com.apple.SystemConfiguration.helper</key>
+               <true/>
        </dict>
 </dict>
 </plist>
index 10dd6df618eb8f493b13c27342a9b1f6caa21b8e..ee55286d4bf9be294fed1beac06965d635fb9ba3 100644 (file)
@@ -6,17 +6,10 @@
        <string>com.apple.SCHelper</string>
        <key>Program</key>
        <string>/System/Library/Frameworks/SystemConfiguration.framework/Resources/SCHelper</string>
-       <key>Sockets</key>
+       <key>MachServices</key>
        <dict>
-               <key>Listeners</key>
-               <dict>
-                       <key>SockFamily</key>
-                       <string>Unix</string>
-                       <key>SockPathMode</key>
-                       <integer>438</integer>
-                       <key>SockPathName</key>
-                       <string>/var/run/SCHelper</string>
-               </dict>
+               <key>com.apple.SystemConfiguration.helper</key>
+               <true/>
        </dict>
 </dict>
 </plist>
diff --git a/SystemConfiguration.fproj/helper/helper.defs b/SystemConfiguration.fproj/helper/helper.defs
new file mode 100644 (file)
index 0000000..e7d0b77
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010 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 13, 2010            Allan Nathanson <ajn@apple.com>
+ * - initial revision
+ */
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+subsystem helper 22000;
+serverprefix _;
+
+import "helper_types.h";
+
+/*
+ * serialized XML or UTF8 data (client->server)
+ */
+type xmlData    = ^ array [] of MACH_MSG_TYPE_BYTE
+       ctype : xmlData_t;
+
+/*
+ * serialized XML or UTF8 data (server->client)
+ */
+type xmlDataOut = ^ array [] of MACH_MSG_TYPE_BYTE
+       ctype : xmlDataOut_t;
+
+
+/*
+ * SCHelper API's
+ */
+
+routine helperinit     (       server          : mach_port_t;
+                        out    session         : mach_port_move_send_t;
+                        out    status          : uint32_t;
+           ServerAuditToken    audit_token     : audit_token_t);
+
+routine helperexec     (       server          : mach_port_t;
+                               msgID           : uint32_t;
+                               data            : xmlData;
+                        out    status          : uint32_t;
+                        out    reply           : xmlDataOut, dealloc);
diff --git a/SystemConfiguration.fproj/helper/helper_comm.c b/SystemConfiguration.fproj/helper/helper_comm.c
deleted file mode 100644 (file)
index fd4193d..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 2005 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@
- */
-
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <CoreFoundation/CoreFoundation.h>
-#include "helper_comm.h"
-
-#include <SystemConfiguration/SCPrivate.h>
-
-
-static ssize_t
-readn(int ref, void *data, size_t len)
-{
-       size_t  left    = len;
-       ssize_t n;
-       void    *p      = data;
-
-       while (left > 0) {
-               if ((n = read(ref, p, left)) == -1) {
-                       if (errno != EINTR) {
-                               return -1;
-                       }
-                       n = 0;
-               } else if (n == 0) {
-                       break; /* EOF */
-               }
-
-               left -= n;
-               p += n;
-       }
-       return (len - left);
-}
-
-
-static ssize_t
-writen(int ref, const void *data, size_t len)
-{
-       size_t          left    = len;
-       ssize_t         n;
-       const void      *p      = data;
-
-       while (left > 0) {
-               if ((n = write(ref, p, left)) == -1) {
-                       if (errno != EINTR) {
-                               return -1;
-                       }
-                       n = 0;
-               }
-               left -= n;
-               p += n;
-       }
-       return len;
-}
-
-
-Boolean
-__SCHelper_txMessage(int fd, uint32_t msgID, CFDataRef data)
-{
-       ssize_t         n_written;
-       uint32_t        header[2];
-
-       header[0] = msgID;
-       header[1] = (data != NULL) ? CFDataGetLength(data) : 0;
-
-       n_written = writen(fd, header, sizeof(header));
-       if (n_written != sizeof(header)) {
-               if ((n_written == -1) && (errno != EPIPE)) {
-                       perror("write() failed while sending msgID");
-               }
-               return FALSE;
-       }
-
-       if (header[1] == 0) {
-               // if no data to send
-               return TRUE;
-       }
-
-       n_written = writen(fd, CFDataGetBytePtr(data), header[1]);
-       if (n_written != header[1]) {
-               if ((n_written == -1) && (errno != EPIPE)) {
-                       perror("write() failed while sending data");
-               }
-               return FALSE;
-       }
-
-       return TRUE;
-}
-
-Boolean
-__SCHelper_rxMessage(int fd, uint32_t *msgID, CFDataRef *data)
-{
-       void            *bytes;
-       size_t          n_read;
-       uint32_t        header[2];
-
-       n_read = readn(fd, header, sizeof(header));
-       if (n_read != sizeof(header)) {
-               if (n_read == -1) {
-                       perror("read() failed while reading msgID");
-               }
-               return FALSE;
-       }
-
-       if (msgID != NULL) {
-               *msgID = header[0];
-       }
-
-       if (header[1] == 0) {
-               if (data != NULL) {
-                       *data = NULL;
-               }
-               return TRUE;
-       } else if ((int32_t)header[1] < 0) {
-               perror("read() failed, invalid data length");
-               return FALSE;
-       }
-
-       bytes  = CFAllocatorAllocate(NULL, header[1], 0);
-       n_read = readn(fd, bytes, header[1]);
-       if (n_read != header[1]) {
-               if (n_read == -1) {
-                       perror("read() failed while reading data");
-               }
-               CFAllocatorDeallocate(NULL, bytes);
-               return FALSE;
-       }
-
-       if (data != NULL) {
-               *data = CFDataCreateWithBytesNoCopy(NULL, bytes, header[1], NULL);
-       } else {
-               // toss reply data
-               CFAllocatorDeallocate(NULL, bytes);
-       }
-
-       return TRUE;
-}
-
-
-Boolean
-_SCHelperExec(int fd, uint32_t msgID, CFDataRef data, uint32_t *status, CFDataRef *reply)
-{
-       Boolean         ok;
-
-       ok = __SCHelper_txMessage(fd, msgID, data);
-       if (!ok) {
-               return FALSE;
-       }
-
-       if ((status == NULL) && (reply == NULL)) {
-               // if no reply expected (one way)
-               return TRUE;
-       }
-
-       ok = __SCHelper_rxMessage(fd, status, reply);
-       if (!ok) {
-               return FALSE;
-       }
-
-       return TRUE;
-}
diff --git a/SystemConfiguration.fproj/helper/helper_comm.h b/SystemConfiguration.fproj/helper/helper_comm.h
deleted file mode 100644 (file)
index 9ea23c8..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2005 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 _HELPER_COMM_H
-#define _HELPER_COMM_H
-
-#include <sys/cdefs.h>
-#include <CoreFoundation/CoreFoundation.h>
-
-__BEGIN_DECLS
-
-Boolean __SCHelper_txMessage(int       fd,
-                            uint32_t   msgID,
-                            CFDataRef  data);
-
-Boolean __SCHelper_rxMessage(int       fd,
-                            uint32_t   *msgID,
-                            CFDataRef  *data);
-
-__END_DECLS
-
-#endif /* _HELPER_COMM_H */
diff --git a/SystemConfiguration.fproj/helper/helper_types.h b/SystemConfiguration.fproj/helper/helper_types.h
new file mode 100644 (file)
index 0000000..91dbb21
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2010 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@
+ */
+
+#ifndef _HELPER_TYPES_H
+#define _HELPER_TYPES_H
+
+/*
+ * Keep IPC functions private to the framework
+ */
+#ifdef mig_external
+#undef mig_external
+#endif
+#define mig_external __private_extern__
+
+/* Turn MIG type checking on by default */
+#ifdef __MigTypeCheck
+#undef __MigTypeCheck
+#endif
+#define __MigTypeCheck 1
+
+/*
+ * Mach server port name
+ */
+#define SCHELPER_SERVER        "com.apple.SystemConfiguration.helper"
+
+/*
+ * Input arguments: serialized key's, list delimiters, ...
+ *     (sent as out-of-line data in a message)
+ */
+typedef const char * xmlData_t;
+
+/* Output arguments: serialized data, lists, ...
+ *     (sent as out-of-line data in a message)
+ */
+typedef char * xmlDataOut_t;
+
+#endif /* !_HELPER_TYPES_H */
index 62838ac2df2436a70c2543f2123f162468282cd9..862125b9468b5e484ca033bb6ddd32ca97a38699 100755 (executable)
@@ -14,7 +14,7 @@ sub clean_INC {
 
        $inc =~ s/#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+<SystemConfiguration\/.*?>.*?\n#else.*?\n//;
        $inc =~ s/#endif\s+.*?USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS.*?\n//;
-       
+
        return $inc;
 }
 
@@ -24,9 +24,7 @@ sub clean_API {
 
        $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;
 }
@@ -37,9 +35,7 @@ sub clean_SPI {
 
        $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;
 }
@@ -67,7 +63,7 @@ for (@headers) {
 
        $spi_new = clean_SPI($spi);
        if ($spi ne $spi_new) {
-#              printf "cleaning .../PrivateHeaders/%s\n", $spi_header;
+               printf "cleaning .../PrivateHeaders/%s\n", $spi_header;
                open(SPI, ">", $spi_path);
                print SPI $spi_new;
                close(SPI);
@@ -98,7 +94,7 @@ for (@headers) {
 
        $api_new = clean_API($api);
        if ($api ne $api_new) {
-#              printf "cleaning .../Headers/%s\n", $api_header;
+               printf "cleaning .../Headers/%s\n", $api_header;
                open(API, ">", $api_path);
                print API $api_new;
                close(API);
@@ -116,7 +112,7 @@ for (@headers) {
 #                                      $spi_header =~ s/\.h$/PRIVATE.h/;
                                }
 
-#                              printf "  adding .../PrivateHeaders/%s\n", $spi_header;
+                               printf "  adding .../PrivateHeaders/%s\n", $spi_header;
                                $spi_path = $SPI_BASE . "/" . $spi_header;
                                open(SPI, ">", $spi_path);
                                print SPI $spi_new;
index 5b817f2e0e9d989b327eca59cb8d25e0b45aaeae..df4a36655e223cd909136fbb076e3ab6ffa6f81a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003, 2004, 2006-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -69,22 +69,16 @@ static void
 removeAllKeys(SCDynamicStoreRef store, Boolean isRegex)
 {
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
-       CFSetRef                        keys;
+       CFArrayRef                      keys;
        CFIndex                         n;
 
        keys = isRegex ? storePrivate->patterns : storePrivate->keys;
-       n = CFSetGetCount(keys);
+       n = (keys != NULL) ? CFArrayGetCount(keys) : 0;
        if (n > 0) {
                CFIndex         i;
                CFArrayRef      keysToRemove;
-               const void *    watchedKeys_q[N_QUICK];
-               const void **   watchedKeys     = watchedKeys_q;
-
-               if (n > (CFIndex)(sizeof(watchedKeys_q) / sizeof(CFStringRef)))
-                       watchedKeys = CFAllocatorAllocate(NULL, n * sizeof(CFStringRef), 0);
-               CFSetGetValues(keys, watchedKeys);
-               keysToRemove = CFArrayCreate(NULL, watchedKeys, n, &kCFTypeArrayCallBacks);
-               if (watchedKeys != watchedKeys_q) CFAllocatorDeallocate(NULL, watchedKeys);
+
+               keysToRemove = CFArrayCreateCopy(NULL, keys);
                for (i = 0; i < n; i++) {
                        (void) __SCDynamicStoreRemoveWatchedKey(store,
                                                                CFArrayGetValueAtIndex(keysToRemove, i),
index 8eebbbb2ece888054715f334ce56007c4b7cca64..5fd22f654073bed8b8e5dbb93001e41ad275c3a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 
 static __inline__ void
-my_CFSetApplyFunction(CFSetRef                 theSet,
-                     CFSetApplierFunction      applier,
-                     void                      *context)
+my_CFArrayApplyFunction(CFArrayRef             theArray,
+                       CFArrayApplierFunction  applier,
+                       void                    *context)
 {
        CFAllocatorRef  myAllocator;
-       CFSetRef        mySet;
+       CFArrayRef      myArray;
 
-       myAllocator = CFGetAllocator(theSet);
-       mySet       = CFSetCreateCopy(myAllocator, theSet);
-       CFSetApplyFunction(mySet, applier, context);
-       CFRelease(mySet);
+       myAllocator = CFGetAllocator(theArray);
+       myArray     = CFArrayCreateCopy(myAllocator, theArray);
+       CFArrayApplyFunction(myArray, CFRangeMake(0, CFArrayGetCount(myArray)), applier, context);
+       CFRelease(myArray);
+       return;
+}
+
+
+static int
+hasKey(CFMutableArrayRef keys, CFStringRef key)
+{
+       if (keys != NULL) {
+               CFIndex n;
+
+               n = CFArrayGetCount(keys);
+               if (CFArrayContainsValue(keys, CFRangeMake(0, n), key)) {
+                       /* sorry, pattern already exists in notifier list */
+                       return kSCStatusKeyExists;
+               }
+       }
+
+       return kSCStatusOK;
+}
+
+
+static void
+addKey(CFMutableArrayRef *keysP, CFStringRef key)
+{
+       if (*keysP == NULL) {
+               *keysP = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       }
+
+       CFArrayAppendValue(*keysP, key);
        return;
 }
 
@@ -76,9 +105,8 @@ __SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean
        sessionNum = CFNumberCreate(NULL, kCFNumberIntType, &storePrivate->server);
 
        if (isRegex) {
-               if (CFSetContainsValue(storePrivate->patterns, key)) {
-                       /* sorry, pattern already exists in notifier list */
-                       sc_status = kSCStatusKeyExists;
+               sc_status = hasKey(storePrivate->patterns, key);
+               if (sc_status != kSCStatusOK) {
                        goto done;
                }
 
@@ -91,11 +119,10 @@ __SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean
                }
 
                /* add pattern to this sessions notifier list */
-               CFSetAddValue(storePrivate->patterns, key);
+               addKey(&storePrivate->patterns, key);
        } else {
-               if (CFSetContainsValue(storePrivate->keys, key)) {
-                       /* sorry, key already exists in notifier list */
-                       sc_status = kSCStatusKeyExists;
+               sc_status = hasKey(storePrivate->keys, key);
+               if (sc_status != kSCStatusOK) {
                        goto done;
                }
 
@@ -106,7 +133,7 @@ __SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean
                _addWatcher(sessionNum, key);
 
                /* add key to this sessions notifier list */
-               CFSetAddValue(storePrivate->keys, key);
+               addKey(&storePrivate->keys, key);
        }
 
     done :
@@ -159,7 +186,7 @@ _notifyadd(mach_port_t                      server,
  */
 typedef struct {
        SCDynamicStoreRef       store;
-       CFSetRef                oldKeys;        /* for addNewKey */
+       CFArrayRef              oldKeys;        /* for addNewKey */
        CFArrayRef              newKeys;        /* for removeOldKey */
        Boolean                 isRegex;
        int                     sc_status;
@@ -202,7 +229,9 @@ addNewKey(const void *value, void *context)
        }
 
        if ((myContextRef->oldKeys == NULL) ||
-           !CFSetContainsValue(myContextRef->oldKeys, newKey)) {
+           !CFArrayContainsValue(myContextRef->oldKeys,
+                                 CFRangeMake(0, CFArrayGetCount(myContextRef->oldKeys)),
+                                 newKey)) {
                /* if this is a new notification key */
                myContextRef->sc_status = __SCDynamicStoreAddWatchedKey(myContextRef->store,
                                                                        newKey,
@@ -237,30 +266,36 @@ __SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef store, CFArrayRef keys, CF
        myContext.sc_status = kSCStatusOK;
 
        /* remove any previously registered keys, register any new keys */
-       myContext.oldKeys = CFSetCreateCopy(NULL, storePrivate->keys);
+       myContext.oldKeys = NULL;
        myContext.newKeys = keys;
        myContext.isRegex = FALSE;
-       my_CFSetApplyFunction(storePrivate->keys, removeOldKey, &myContext);
+       if (storePrivate->keys != NULL) {
+               myContext.oldKeys = CFArrayCreateCopy(NULL, storePrivate->keys);
+               my_CFArrayApplyFunction(storePrivate->keys, removeOldKey, &myContext);
+       }
        if (keys != NULL) {
                CFArrayApplyFunction(keys,
                                     CFRangeMake(0, CFArrayGetCount(keys)),
                                     addNewKey,
                                     &myContext);
        }
-       CFRelease(myContext.oldKeys);
+       if (myContext.oldKeys != NULL) CFRelease(myContext.oldKeys);
 
        /* remove any previously registered patterns, register any new patterns */
-       myContext.oldKeys = CFSetCreateCopy(NULL, storePrivate->patterns);
+       myContext.oldKeys = NULL;
        myContext.newKeys = patterns;
        myContext.isRegex = TRUE;
-       my_CFSetApplyFunction(storePrivate->patterns, removeOldKey, &myContext);
+       if (storePrivate->patterns != NULL) {
+               myContext.oldKeys = CFArrayCreateCopy(NULL, storePrivate->patterns);
+               my_CFArrayApplyFunction(storePrivate->patterns, removeOldKey, &myContext);
+       }
        if (patterns != NULL) {
                CFArrayApplyFunction(patterns,
                                     CFRangeMake(0, CFArrayGetCount(patterns)),
                                     addNewKey,
                                     &myContext);
        }
-       CFRelease(myContext.oldKeys);
+       if (myContext.oldKeys != NULL) CFRelease(myContext.oldKeys);
 
        return myContext.sc_status;
 }
index e77c7772d267ae83860ea3ef8356d5ec6ed61a64..5af640556d8900b0886b457cfc79eb3d0e38f6ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include "pattern.h"
 
 
+static int
+removeKey(CFMutableArrayRef keys, CFStringRef key)
+{
+       CFIndex i;
+       CFIndex n;
+
+       if (keys == NULL) {
+               /* sorry, empty notifier list */
+               return kSCStatusNoKey;
+       }
+
+       n = CFArrayGetCount(keys);
+       i = CFArrayGetFirstIndexOfValue(keys, CFRangeMake(0, n), key);
+       if (i == kCFNotFound) {
+               /* sorry, key does not exist in notifier list */
+               return kSCStatusNoKey;
+       }
+
+       /* remove key from this sessions notifier list */
+       CFArrayRemoveValueAtIndex(keys, i);
+       return kSCStatusOK;
+}
+
+
 __private_extern__
 int
 __SCDynamicStoreRemoveWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean isRegex, Boolean internal)
 {
+       int                             sc_status       = kSCStatusOK;
        CFNumberRef                     sessionNum;
-       SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
+       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
        if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
                return kSCStatusNoStoreSession; /* you must have an open session to play */
@@ -62,22 +87,20 @@ __SCDynamicStoreRemoveWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boole
         * it was previously defined.
         */
        if (isRegex) {
-               if (!CFSetContainsValue(storePrivate->patterns, key))
-                       return kSCStatusNoKey;          /* sorry, key does not exist in notifier list */
-
-               /* remove key from this sessions notifier list */
-               CFSetRemoveValue(storePrivate->patterns, key);
+               sc_status = removeKey(storePrivate->patterns, key);
+               if (sc_status != kSCStatusOK) {
+                       goto done;
+               }
 
                /* remove this session as a pattern watcher */
                sessionNum = CFNumberCreate(NULL, kCFNumberIntType, &storePrivate->server);
                patternRemoveSession(key, sessionNum);
                CFRelease(sessionNum);
        } else {
-               if (!CFSetContainsValue(storePrivate->keys, key))
-                       return kSCStatusNoKey;          /* sorry, key does not exist in notifier list */
-
-               /* remove key from this sessions notifier list */
-               CFSetRemoveValue(storePrivate->keys, key);
+               sc_status = removeKey(storePrivate->keys, key);
+               if (sc_status != kSCStatusOK) {
+                       goto done;
+               }
 
                /*
                 * We are watching a specific key. As such, update the
@@ -88,7 +111,9 @@ __SCDynamicStoreRemoveWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boole
                CFRelease(sessionNum);
        }
 
-       return kSCStatusOK;
+    done :
+
+       return sc_status;
 }
 
 
index 870813cae7aed1046c151e4eabfd8b29534da98a..2cda2b78eb0ba45595d2787a92fa9bc3739d67ad 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2006, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2006, 2008-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -146,6 +146,12 @@ _notifyviafd(mach_port_t           server,
                }
        }
 
+       if (!hasPathAccess(mySession, un.sun_path)) {
+               *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);
 
index 4459095643179611f5e833bd46d893c9cc1203f9..2c94f852e5772388995d71ea5b46e995f8cf45c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2006, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -42,9 +42,9 @@
 
 
 #define        SNAPSHOT_PATH_STATE     _PATH_VARTMP "configd-state"
-#define        SNAPSHOT_PATH_STORE     _PATH_VARTMP "configd-store.xml"
-#define        SNAPSHOT_PATH_PATTERN   _PATH_VARTMP "configd-pattern.xml"
-#define        SNAPSHOT_PATH_SESSION   _PATH_VARTMP "configd-session.xml"
+#define        SNAPSHOT_PATH_STORE     _PATH_VARTMP "configd-store.plist"
+#define        SNAPSHOT_PATH_PATTERN   _PATH_VARTMP "configd-pattern.plist"
+#define        SNAPSHOT_PATH_SESSION   _PATH_VARTMP "configd-session.plist"
 
 
 #define N_QUICK        100
@@ -80,11 +80,9 @@ _expandStore(CFDictionaryRef storeData)
                        if (data) {
                                CFPropertyListRef       plist;
 
-                               if (!_SCUnserialize(&plist, data, NULL, 0)) {
-                                       goto done;
-                               }
-
                                nValues[i] = CFDictionaryCreateMutableCopy(NULL, 0, oValues[i]);
+
+                               _SCUnserialize(&plist, data, NULL, 0);
                                CFDictionarySetValue((CFMutableDictionaryRef)nValues[i],
                                                     kSCDData,
                                                     plist);
@@ -102,13 +100,11 @@ _expandStore(CFDictionaryRef storeData)
                                     &kCFTypeDictionaryKeyCallBacks,
                                     &kCFTypeDictionaryValueCallBacks);
 
-    done :
-
        if (nElements > 0) {
                CFIndex i;
 
                for (i = 0; i < nElements; i++) {
-                       if (nValues[i]) CFRelease(nValues[i]);
+                       CFRelease(nValues[i]);
                }
 
                if (keys != keys_q) {
@@ -169,10 +165,10 @@ __SCDynamicStoreSnapshot(SCDynamicStoreRef store)
        }
 
        expandedStoreData = _expandStore(storeData);
-       xmlData = CFPropertyListCreateXMLData(NULL, expandedStoreData);
+       xmlData = CFPropertyListCreateData(NULL, expandedStoreData, kCFPropertyListXMLFormat_v1_0, 0, NULL);
        CFRelease(expandedStoreData);
-       if (!xmlData) {
-               SCLog(TRUE, LOG_ERR, CFSTR("__SCDynamicStoreSnapshot CFPropertyListCreateXMLData() failed"));
+       if (xmlData == NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("__SCDynamicStoreSnapshot CFPropertyListCreateData() failed"));
                close(fd);
                return kSCStatusFailed;
        }
@@ -188,9 +184,9 @@ __SCDynamicStoreSnapshot(SCDynamicStoreRef store)
                return kSCStatusFailed;
        }
 
-       xmlData = CFPropertyListCreateXMLData(NULL, patternData);
-       if (!xmlData) {
-               SCLog(TRUE, LOG_ERR, CFSTR("__SCDynamicStoreSnapshot CFPropertyListCreateXMLData() failed"));
+       xmlData = CFPropertyListCreateData(NULL, patternData, kCFPropertyListXMLFormat_v1_0, 0, NULL);
+       if (xmlData == NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("__SCDynamicStoreSnapshot CFPropertyListCreateData() failed"));
                close(fd);
                return kSCStatusFailed;
        }
@@ -206,9 +202,9 @@ __SCDynamicStoreSnapshot(SCDynamicStoreRef store)
                return kSCStatusFailed;
        }
 
-       xmlData = CFPropertyListCreateXMLData(NULL, sessionData);
-       if (!xmlData) {
-               SCLog(TRUE, LOG_ERR, CFSTR("__SCDynamicStoreSnapshot CFPropertyListCreateXMLData() failed"));
+       xmlData = CFPropertyListCreateData(NULL, sessionData, kCFPropertyListXMLFormat_v1_0, 0, NULL);
+       if (xmlData == NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("__SCDynamicStoreSnapshot CFPropertyListCreateData() failed"));
                close(fd);
                return kSCStatusFailed;
        }
index 50243defc15c98771dbd0a60fa021eaf0e547b57..3ffea54199ac933318772a8e59f86e6c41c8e858 100644 (file)
@@ -8,8 +8,6 @@
        <true/>
        <key>Label</key>
        <string>com.apple.configd</string>
-       <key>MachExceptionHandler</key>
-       <string>com.apple.ReportCrash.DirectoryService</string>
        <key>MachServices</key>
        <dict>
                <key>com.apple.SystemConfiguration.configd</key>
index 1cb36dabca6c5d6007bcb48d0b6dfac2938c9c9e..f697803fe94e9741ec68f7acb238026758dab4af 100644 (file)
@@ -1,7 +1,7 @@
 .\"
 .\"     @(#)configd.8
 .\"
-.Dd November 4, 2003
+.Dd June 18, 2009
 .Dt CONFIGD 8
 .Os "Mac OS X"
 .Sh NAME
@@ -117,7 +117,7 @@ the priority is greater than LOG_NOTICE).
 was designed to run without any intervention but if you insist on sending a signal to the daemon then the following are available:
 .Bl -tag -width SIGTERM
 .It Dv SIGHUP
-This signal, typically used to tell a daemon to reload it's configuration, is ignored (there is no configuration).
+This signal, typically used to tell a daemon to reload its configuration, is ignored (there is no configuration).
 .It Dv SIGTERM
 This signal initiates a
 .Qq graceful
index 9a6958e970199b7aab0c92a09341eb3521e4448e..d701c2428e377bcec14ec72c342a0f643ac460fa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -34,6 +34,8 @@
  * - created
  */
 
+//#define DO_NOT_INFORM
+
 #include <getopt.h>
 #include <stdio.h>
 #include <sysexits.h>
 #include "configd_server.h"
 #include "plugin_support.h"
 
+#if    TARGET_OS_EMBEDDED && !TARGET_OS_EMBEDDED_OTHER && !defined(DO_NOT_INFORM)
+#include <CoreFoundation/CFUserNotification.h>
+#endif // TARGET_OS_EMBEDDED && !TARGET_OS_EMBEDDED_OTHER && !defined(DO_NOT_INFORM)
+
 __private_extern__
 Boolean        _configd_verbose                = FALSE;        /* TRUE if verbose logging enabled */
 
@@ -75,6 +81,7 @@ static const struct option longopts[] = {
 //     { "no-bundles",         no_argument,            0,      'b' },
 //     { "exclude-plugin",     required_argument,      0,      'B' },
 //     { "no-fork",            no_argument,            0,      'd' },
+//     { "fork-all",           no_argument,            0,      'f' },
 //     { "test-bundle",        required_argument,      0,      't' },
 //     { "verbose",            no_argument,            0,      'v' },
 //     { "verbose-bundle",     required_argument,      0,      'V' },
@@ -91,6 +98,7 @@ usage(const char *prog)
        SCPrint(TRUE, stderr, CFSTR("\t-d\tdisable daemon/run in foreground\n"));
        SCPrint(TRUE, stderr, CFSTR("\t-v\tenable verbose logging\n"));
        SCPrint(TRUE, stderr, CFSTR("\t-V\tenable verbose logging for the specified plug-in\n"));
+       SCPrint(TRUE, stderr, CFSTR("\t-f\tload ALL plug-ins in a separate process\n"));
        SCPrint(TRUE, stderr, CFSTR("\t-b\tdisable loading of ALL plug-ins\n"));
        SCPrint(TRUE, stderr, CFSTR("\t-B\tdisable loading of the specified plug-in\n"));
        SCPrint(TRUE, stderr, CFSTR("\t-t\tload/test the specified plug-in\n"));
@@ -349,6 +357,33 @@ main(int argc, char * const argv[])
        /* check if we have been started by launchd */
        vproc_swap_integer(NULL, VPROC_GSK_IS_MANAGED, NULL, &is_launchd_job);
 
+#if    TARGET_OS_EMBEDDED && !TARGET_OS_EMBEDDED_OTHER && !defined(DO_NOT_INFORM)
+       // if launchd job, check to see if we have been restarted
+       if (is_launchd_job) {
+               int64_t status  = 0;
+
+               vproc_swap_integer(NULL, VPROC_GSK_LAST_EXIT_STATUS, NULL, &status);
+               if ((status != 0) && _SC_isAppleInternal()) {
+                       int     fd;
+
+                       // if we've been restarted
+                       fd = open("/var/run/configd-crash-reported", O_WRONLY|O_CREAT|O_EXCL, 0644);
+                       if (fd >= 0) {
+                               // if we have not yet alerted the user
+                               CFUserNotificationDisplayNotice(0,
+                                                               kCFUserNotificationStopAlertLevel,
+                                                               NULL,
+                                                               NULL,
+                                                               NULL,
+                                                               CFSTR("\"configd\" restarted"),
+                                                               CFSTR("Please collect the crash report and file a Radar."),
+                                                               NULL);
+                               close(fd);
+                       }
+               }
+       }
+#endif // TARGET_OS_EMBEDDED && !TARGET_OS_EMBEDDED_OTHER && !defined(DO_NOT_INFORM)
+
        /* ensure that forked plugins behave */
        if ((testBundle != NULL) && (getenv("__FORKED_PLUGIN__") != NULL)) {
                forcePlugin = TRUE;
index 6b2af162157c2aebf5ef2c6c0e0218a2b20afc5f..dce8172da878c1613b4a676bd25ec52b771a86d8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -136,6 +136,7 @@ configdCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
        if (bufSize > sizeof(bufReply_q)) {
                bufReply = CFAllocatorAllocate(NULL, _config_subsystem.maxsize, 0);
        }
+       bufReply->RetCode = 0;
 
        /* we have a request message */
        (void) config_demux(&bufRequest->Head, &bufReply->Head);
@@ -269,19 +270,19 @@ int
 server_shutdown()
 {
        if (configd_port != NULL) {
-               mach_port_t     service_port;
+               mach_port_t     service_port    = CFMachPortGetPort(configd_port);
+
+               CFMachPortSetInvalidationCallBack(configd_port, NULL);
+               CFMachPortInvalidate(configd_port);
+               CFRelease(configd_port);
+               configd_port = NULL;
 
-               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);
                }
-
-               CFMachPortInvalidate(configd_port);
-               CFRelease(configd_port);
-               configd_port = NULL;
        }
 
        return EX_OK;
@@ -294,6 +295,8 @@ server_loop()
 {
        CFStringRef     rlMode;
 
+       pthread_setname_np("SCDynamicStore");
+
        while (TRUE) {
                /*
                 * process one run loop event
index ec0be1609b657d954e98cf572ac1cb07f021dabd..9309ae13edc341ab5e60b37b54a772dc672ba623 100644 (file)
@@ -5,6 +5,7 @@
        <key>keychain-access-groups</key>
        <array>
                <string>apple</string>
+               <string>com.apple.identities</string>
        </array>
        <key>com.apple.springboard.launchapplications</key>
        <true/>
index 207491ba475510f6203a6c6656bf2f3a334542c0..58a87be26409e18ab728bba212f6f3c9443be667 100644 (file)
@@ -126,10 +126,15 @@ patternCompile(CFStringRef pattern, regex_t *preg, CFStringRef *error)
        Boolean         append          = FALSE;
        Boolean         insert          = FALSE;
        CFIndex         len             = 0;
+       CFIndex         len_c;
        Boolean         ok;
        char            str_q[256];
        char *          str             = str_q;
 
+       if (CFStringGetLength(pattern) == 0) {
+               SCLog(TRUE, LOG_ERR, CFSTR("patternCompile(): empty string"));
+       }
+
        if (!CFStringHasPrefix(pattern, CFSTR("^"))) {
                insert = TRUE;
        }
@@ -149,14 +154,18 @@ patternCompile(CFStringRef pattern, regex_t *preg, CFStringRef *error)
                                                 append ? "$" : "");
        }
 
-       (void)CFStringGetBytes(pattern,
-                              CFRangeMake(0, CFStringGetLength(pattern)),
-                              kCFStringEncodingASCII,
-                              0,
-                              FALSE,
-                              NULL,
-                              0,
-                              &len);
+       len_c = CFStringGetBytes(pattern,
+                                CFRangeMake(0, CFStringGetLength(pattern)),
+                                kCFStringEncodingASCII,
+                                0,
+                                FALSE,
+                                NULL,
+                                0,
+                                &len);
+       if (len_c <= 0) {
+               SCLog(TRUE, LOG_ERR, CFSTR("patternCompile(): could not get buffer length for \"%@\""), pattern);
+               len = sizeof(str_q) - 1;
+       }
        if (++len > (CFIndex)sizeof(str_q)) {
                str = CFAllocatorAllocate(NULL, len, 0);
        }
index f0a550662e220b5a093effaff73414c9d276c226..eded4d67180d96fd77b1f9303db54ab545ede52a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -37,7 +37,6 @@
  * - initial revision
  */
 
-#include <mach-o/dyld.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
@@ -709,9 +708,14 @@ stopBundles()
        } else {
                CFRunLoopTimerRef       timer;
 
-               /* sorry, we're not going to wait longer than 20 seconds */
+               /*
+                * launchd will only wait 20 seconds before sending us a
+                * SIGKILL and because we want to know what's stuck before
+                * that time so set our own "we're not waiting any longer"
+                * timeout for 15 seconds.
+                */
                timer = CFRunLoopTimerCreate(NULL,                              /* allocator */
-                                            CFAbsoluteTimeGetCurrent() + 20.0, /* fireDate (in 20 seconds) */
+                                            CFAbsoluteTimeGetCurrent() + 15.0, /* fireDate (in 15 seconds) */
                                             0.0,                               /* interval (== one-shot) */
                                             0,                                 /* flags */
                                             0,                                 /* order */
@@ -878,6 +882,19 @@ sortBundles(CFMutableArrayRef orig)
 }
 
 
+/*
+ * ALT_CFRelease()
+ *
+ * An alternate CFRelease() that we can use to fake out the
+ * static analyzer.
+ */
+static __inline__ void
+ALT_CFRelease(CFTypeRef cf)
+{
+       CFRelease(cf);
+}
+
+
 __private_extern__
 void *
 plugin_exec(void *arg)
@@ -923,6 +940,17 @@ plugin_exec(void *arg)
 
                                        bundle = (CFBundleRef)CFArrayGetValueAtIndex(bundles, i);
                                        addBundle(bundle, FALSE);
+
+                                       // The CFBundleCreateBundlesFromDirectory() API has
+                                       // a known/outstanding bug in that it over-retains the
+                                       // returned bundles.  Since we do not expect this to
+                                       // be fixed we release the extra references.
+                                       //
+                                       //   See <rdar://problems/4912137&6078752> for more info.
+                                       //
+                                       // Also, we use the hack below to keep the static
+                                       // analyzer happy.
+                                       ALT_CFRelease(bundle);
                                }
                                CFRelease(bundles);
                        }
@@ -1043,6 +1071,7 @@ plugin_exec(void *arg)
         */
        SCLog(_configd_verbose, LOG_DEBUG, CFSTR("starting plugin CFRunLoop"));
        plugin_runLoop = CFRunLoopGetCurrent();
+       pthread_setname_np("Main plugin thread");
        CFRunLoopRun();
 
     done :
index bc25fe2afc53496486a7bde947ec0a8f8aa35612..ccce9b33c5f8480bedc60e16fca3d37bf0e906dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2007-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 #include <unistd.h>
 #include <bsm/libbsm.h>
+#include <sandbox.h>
+
 
 /* information maintained for each active session */
 static serverSessionRef        *sessions = NULL;
 static int             nSessions = 0;
 
+/* CFMachPortInvalidation runloop */
+static CFRunLoopRef    sessionRunLoop  = NULL;
+
+
+static void
+CFMachPortInvalidateSessionCallback(CFMachPortRef port, void *info)
+{
+       CFRunLoopRef    currentRunLoop  = CFRunLoopGetCurrent();
+
+       // Bear trap
+       if (!_SC_CFEqual(currentRunLoop, sessionRunLoop)) {
+               _SC_crash("SCDynamicStore CFMachPort invalidation error",
+                          CFSTR("CFMachPort invalidated"),
+                          CFSTR("An SCDynamicStore CFMachPort has incorrectly been invalidated."));
+       }
+}
+
 
 __private_extern__
 serverSessionRef
@@ -79,7 +98,12 @@ 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;
+       int                     n       = -1;
+
+       /* save current (SCDynamicStore) runloop */
+       if (sessionRunLoop == NULL) {
+               sessionRunLoop = CFRunLoopGetCurrent();
+       }
 
        if (nSessions <= 0) {
                /* new session (actually, the first) found */
@@ -124,11 +148,17 @@ addSession(mach_port_t server, CFStringRef (*copyDescription)(const void *info))
        //       right present to ensure that CF does not establish
        //       its dead name notification.
        //
-       sessions[n]->serverPort = CFMachPortCreateWithPort(NULL,
-                                                          mp,
-                                                          configdCallback,
-                                                          &context,
-                                                          NULL);
+       sessions[n]->serverPort = _SC_CFMachPortCreateWithPort("SCDynamicStore/session",
+                                                              mp,
+                                                              configdCallback,
+                                                              &context);
+
+       //
+       // Set bear trap (an invalidation callback) to catch other
+       // threads stomping on us
+       //
+       CFMachPortSetInvalidationCallBack(sessions[n]->serverPort,
+                                         CFMachPortInvalidateSessionCallback);
 
        if (server == MACH_PORT_NULL) {
                // insert send right that will be moved to the client
@@ -303,7 +333,7 @@ listSessions(FILE *f)
 }
 
 
-#if    TARGET_OS_IPHONE
+#if    TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
 
 #include <Security/Security.h>
 #include <Security/SecTask.h>
@@ -340,12 +370,12 @@ hasEntitlement(serverSessionRef session, CFStringRef entitlement)
                CFTypeRef       value;
 
                /* Get the value for the entitlement. */
-               value = SecTaskCopyValueForEntitlement(task, kSCWriteEntitlementName, &error);
+               value = SecTaskCopyValueForEntitlement(task, entitlement, &error);
                if (value != NULL) {
                        if (isA_CFBoolean(value)) {
                                if (CFBooleanGetValue(value)) {
                                        /* if client DOES have entitlement */
-                                       hasEntitlement = YES;
+                                       hasEntitlement = TRUE;
                                }
                        } else {
                                SCLog(TRUE, LOG_ERR,
@@ -354,10 +384,14 @@ hasEntitlement(serverSessionRef session, CFStringRef entitlement)
                        }
 
                        CFRelease(value);
-               } else if (error != NULL) {
-                       SCLog(TRUE, LOG_ERR,
-                             CFSTR("hasEntitlement SecTaskCopyValueForEntitlement() failed, error=%@: %@"),
-                             error,
+               }
+               if (error != NULL) {
+                       SCLog(TRUE,
+                             (value == NULL) ? LOG_ERR : LOG_DEBUG,
+                             CFSTR("hasEntitlement SecTaskCopyValueForEntitlement() %s, error domain=%@, error code=%lx"),
+                             (value == NULL) ? "failed" : "warned",
+                             CFErrorGetDomain(error),
+                             CFErrorGetCode(error),
                              sessionName(session));
                        CFRelease(error);
                }
@@ -372,7 +406,7 @@ hasEntitlement(serverSessionRef session, CFStringRef entitlement)
        return hasEntitlement;
 }
 
-#endif // TARGET_OS_IPHONE
+#endif  // TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
 
 
 __private_extern__
@@ -412,13 +446,44 @@ hasWriteAccess(serverSessionRef session)
                        // grant write access to eUID==0 processes
                        session->callerWriteAccess = YES;
                }
-#if    TARGET_OS_IPHONE
+#if    TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
                else if (hasEntitlement(session, kSCWriteEntitlementName)) {
                        // grant write access to "entitled" processes
                        session->callerWriteAccess = YES;
                }
-#endif // TARGET_OS_IPHONE
+#endif  // TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
        }
 
        return (session->callerWriteAccess == YES) ? TRUE : FALSE;
 }
+
+
+__private_extern__
+Boolean
+hasPathAccess(serverSessionRef session, const char *path)
+{
+       pid_t   pid;
+       char    realPath[PATH_MAX];
+
+       if (realpath(path, realPath) == NULL) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("hasPathAccess realpath() failed: %s"), strerror(errno));
+               return FALSE;
+       }
+
+       audit_token_to_au32(session->auditToken,
+                           NULL,               // auidp
+                           NULL,               // euid
+                           NULL,               // egid
+                           NULL,               // ruid
+                           NULL,               // rgid
+                           &pid,               // pid
+                           NULL,               // asid
+                           NULL);              // tid
+
+       if (sandbox_check(pid, "file-write-data", SANDBOX_FILTER_PATH, realPath) > 0) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("hasPathAccess sandbox access denied: %s"), strerror(errno));
+               return FALSE;
+       }
+
+       return TRUE;
+}
index 37817d16099461475a6fe7bc1ef92dc57ce6168a..6e4962f43eb0e341e4531b220a0a77bedfd6998b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2005-2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2005-2007, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <TargetConditionals.h>
 
 
-#if    TARGET_OS_IPHONE
+#if    TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
 #define        kSCWriteEntitlementName CFSTR("com.apple.SystemConfiguration.SCDynamicStore-write-access")
-#endif // TARGET_OS_IPHONE
+#endif  // TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
 
 
-typedef        enum { UNKNOWN, NO, YES } lazyBoolean;
+typedef        enum { NO = 0, YES, UNKNOWN } lazyBoolean;
 
 
 /* Per client server state */
@@ -91,6 +91,9 @@ Boolean                       hasRootAccess   (serverSessionRef       session);
 
 Boolean                        hasWriteAccess  (serverSessionRef       session);
 
+Boolean                        hasPathAccess   (serverSessionRef       session,
+                                        const char             *path);
+
 __END_DECLS
 
 #endif /* !_S_SESSION_H */
index a29f24279b63726a720c293abb53e24cc9b7b2ff..b572e25d40e4305e85c118b86f49d9b7948c086b 100644 (file)
                        name = "configd_executables-Embedded";
                        productName = configd_executables;
                };
+               1583E9E01083959E00A3BC0C /* All-EmbeddedOther */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 1583E9E91083959E00A3BC0C /* Build configuration list for PBXAggregateTarget "All-EmbeddedOther" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               15AC515810839608004A9ED5 /* PBXTargetDependency */,
+                               15AC515B1083960E004A9ED5 /* PBXTargetDependency */,
+                               15AC515D10839613004A9ED5 /* PBXTargetDependency */,
+                               15AC515F1083961E004A9ED5 /* PBXTargetDependency */,
+                       );
+                       name = "All-EmbeddedOther";
+                       productName = Embedded;
+               };
+               1583E9FD108395BB00A3BC0C /* configd_libSystem-EmbeddedOther */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 1583EA01108395BB00A3BC0C /* Build configuration list for PBXAggregateTarget "configd_libSystem-EmbeddedOther" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               15AC516110839649004A9ED5 /* PBXTargetDependency */,
+                       );
+                       name = "configd_libSystem-EmbeddedOther";
+                       productName = configd_libSystem;
+               };
+               1583EA11108395BB00A3BC0C /* configd_base-EmbeddedOther */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 1583EA16108395BB00A3BC0C /* Build configuration list for PBXAggregateTarget "configd_base-EmbeddedOther" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               15AC516310839666004A9ED5 /* PBXTargetDependency */,
+                               15AC51651083966B004A9ED5 /* PBXTargetDependency */,
+                       );
+                       name = "configd_base-EmbeddedOther";
+                       productName = Frameworks;
+               };
+               1583EAAC108395BB00A3BC0C /* configd_plugins-EmbeddedOther */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 1583EAC7108395BB00A3BC0C /* Build configuration list for PBXAggregateTarget "configd_plugins-EmbeddedOther" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               15AC5189108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC5187108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC5185108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC5183108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC5181108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC517F108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC517D108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC517B108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC5179108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC5177108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC5175108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC5173108396D2004A9ED5 /* PBXTargetDependency */,
+                               15AC5171108396D2004A9ED5 /* PBXTargetDependency */,
+                       );
+                       name = "configd_plugins-EmbeddedOther";
+                       productName = Plugins;
+               };
+               1583EB41108395BD00A3BC0C /* configd_executables-EmbeddedOther */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 1583EB48108395BD00A3BC0C /* Build configuration list for PBXAggregateTarget "configd_executables-EmbeddedOther" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               15AC516E108396B7004A9ED5 /* PBXTargetDependency */,
+                               15AC516C108396B7004A9ED5 /* PBXTargetDependency */,
+                               15AC516A108396B7004A9ED5 /* PBXTargetDependency */,
+                       );
+                       name = "configd_executables-EmbeddedOther";
+                       productName = configd_executables;
+               };
                159D542007528E7C004F8947 /* configd_plugins */ = {
                        isa = PBXAggregateTarget;
                        buildConfigurationList = 156EB61E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_plugins" */;
                        isa = PBXAggregateTarget;
                        buildConfigurationList = 15C64A270F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem" */;
                        buildPhases = (
-                               15BED7930F6853F800016614 /* OLD libdnsinfo.a */,
                        );
                        dependencies = (
                                15C64A220F684C4900D78394 /* PBXTargetDependency */,
                        isa = PBXAggregateTarget;
                        buildConfigurationList = 15C64A2B0F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem-Embedded" */;
                        buildPhases = (
-                               15BED7A20F68551200016614 /* OLD libdnsinfo.a */,
                        );
                        dependencies = (
                                15C64A310F684C8F00D78394 /* PBXTargetDependency */,
                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 */; };
+               152691D81129EE8A006BD2D5 /* BondConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 9EE943F306AF409B00772EB5 /* BondConfiguration.c */; };
+               152691D91129EE94006BD2D5 /* BondConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 9EE943F306AF409B00772EB5 /* BondConfiguration.c */; };
+               152691DA1129EE98006BD2D5 /* BondConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 9EE943F306AF409B00772EB5 /* BondConfiguration.c */; };
+               152691DB1129EEA6006BD2D5 /* BridgeConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FD7B3B101E439200C56621 /* BridgeConfiguration.c */; };
+               152691DC1129EEAD006BD2D5 /* BridgeConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FD7B3B101E439200C56621 /* BridgeConfiguration.c */; };
+               152691DD1129EEB1006BD2D5 /* BridgeConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FD7B3B101E439200C56621 /* BridgeConfiguration.c */; };
+               152691DE1129EEC2006BD2D5 /* VLANConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B605C0722B0099E85F /* VLANConfiguration.c */; };
+               152691DF1129EEC8006BD2D5 /* VLANConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B605C0722B0099E85F /* VLANConfiguration.c */; };
+               152691E01129EECB006BD2D5 /* VLANConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B605C0722B0099E85F /* VLANConfiguration.c */; };
+               152E0E7F10FE820E00E402F2 /* helper.defs in Sources */ = {isa = PBXBuildFile; fileRef = 152E0E7E10FE820E00E402F2 /* helper.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+               152E0E8010FE820E00E402F2 /* helper.defs in Sources */ = {isa = PBXBuildFile; fileRef = 152E0E7E10FE820E00E402F2 /* helper.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+               152E0E8110FE820E00E402F2 /* helper.defs in Sources */ = {isa = PBXBuildFile; fileRef = 152E0E7E10FE820E00E402F2 /* helper.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+               152E0E8910FE824000E402F2 /* helper_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E0E8810FE824000E402F2 /* helper_types.h */; };
+               152E0E8A10FE824000E402F2 /* helper_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E0E8810FE824000E402F2 /* helper_types.h */; };
+               152E0E8B10FE824000E402F2 /* helper_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E0E8810FE824000E402F2 /* helper_types.h */; };
                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 */; };
                1533D77B0B10A14300CA4946 /* libNetworkIdentification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */; };
                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, ); }; };
                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 */; };
                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 */; };
+               1575FD2712CD15C60003D86E /* proxy-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 1575FD2512CD15C60003D86E /* proxy-configuration.c */; };
+               1575FD2812CD15C60003D86E /* proxy-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1575FD2612CD15C60003D86E /* proxy-configuration.h */; };
+               1575FD2912CD15C60003D86E /* proxy-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 1575FD2512CD15C60003D86E /* proxy-configuration.c */; };
+               1575FD2A12CD15C60003D86E /* proxy-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1575FD2612CD15C60003D86E /* proxy-configuration.h */; };
+               1575FD2B12CD15C60003D86E /* proxy-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 1575FD2512CD15C60003D86E /* proxy-configuration.c */; };
+               1575FD2C12CD15C60003D86E /* proxy-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1575FD2612CD15C60003D86E /* proxy-configuration.h */; };
                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 */; };
                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 */; };
+               1583EA06108395BB00A3BC0C /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               1583EA07108395BB00A3BC0C /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; };
+               1583EA09108395BB00A3BC0C /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               1583EA0A108395BB00A3BC0C /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; };
+               1583EA0B108395BB00A3BC0C /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
+               1583EA1B108395BB00A3BC0C /* SCSchemaDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               1583EA1C108395BB00A3BC0C /* SystemConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691305C0722B0099E85F /* SystemConfiguration.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1583EA1D108395BB00A3BC0C /* SCPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691505C0722B0099E85F /* SCPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1583EA1E108395BB00A3BC0C /* SCDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691705C0722B0099E85F /* SCDPlugin.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA1F108395BB00A3BC0C /* SCDynamicStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691B05C0722B0099E85F /* SCDynamicStoreInternal.h */; settings = {ATTRIBUTES = (Project, ); }; };
+               1583EA20108395BB00A3BC0C /* SCDynamicStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691D05C0722B0099E85F /* SCDynamicStore.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1583EA21108395BB00A3BC0C /* SCDynamicStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691F05C0722B0099E85F /* SCDynamicStorePrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1583EA22108395BB00A3BC0C /* SCDynamicStoreKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692105C0722B0099E85F /* SCDynamicStoreKey.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1583EA23108395BB00A3BC0C /* SCDynamicStoreCopySpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692305C0722B0099E85F /* SCDynamicStoreCopySpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1583EA24108395BB00A3BC0C /* SCDynamicStoreCopySpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692505C0722B0099E85F /* SCDynamicStoreCopySpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1583EA25108395BB00A3BC0C /* SCDynamicStoreSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692705C0722B0099E85F /* SCDynamicStoreSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1583EA26108395BB00A3BC0C /* SCPreferencesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692905C0722B0099E85F /* SCPreferencesInternal.h */; settings = {ATTRIBUTES = (Project, ); }; };
+               1583EA27108395BB00A3BC0C /* SCPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692B05C0722B0099E85F /* SCPreferences.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1583EA28108395BB00A3BC0C /* SCPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692D05C0722B0099E85F /* SCPreferencesPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1583EA29108395BB00A3BC0C /* SCPreferencesPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692F05C0722B0099E85F /* SCPreferencesPath.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1583EA2A108395BB00A3BC0C /* SCPreferencesSetSpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1583EA2B108395BB00A3BC0C /* SCNetworkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               1583EA2C108395BB00A3BC0C /* SCNetworkConfigurationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A3A0670A85900BFE03C /* SCNetworkConfigurationInternal.h */; settings = {ATTRIBUTES = (); }; };
+               1583EA2D108395BB00A3BC0C /* SCNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693305C0722B0099E85F /* SCNetwork.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1583EA2E108395BB00A3BC0C /* SCNetworkConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693505C0722B0099E85F /* SCNetworkConnection.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1583EA2F108395BB00A3BC0C /* SCNetworkReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693705C0722B0099E85F /* SCNetworkReachability.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1583EA30108395BB00A3BC0C /* SCValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693905C0722B0099E85F /* SCValidation.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1583EA31108395BB00A3BC0C /* DHCPClientPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               1583EA32108395BB00A3BC0C /* SCDynamicStoreCopyDHCPInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693F05C0722B0099E85F /* SCDynamicStoreCopyDHCPInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               1583EA33108395BB00A3BC0C /* moh_msg.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694105C0722B0099E85F /* moh_msg.h */; };
+               1583EA34108395BB00A3BC0C /* moh.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694305C0722B0099E85F /* moh.h */; };
+               1583EA35108395BB00A3BC0C /* DeviceOnHold.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694505C0722B0099E85F /* DeviceOnHold.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA36108395BB00A3BC0C /* dy_framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694905C0722B0099E85F /* dy_framework.h */; };
+               1583EA37108395BB00A3BC0C /* SCPreferencesPathKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA38108395BB00A3BC0C /* pppcontroller_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */; };
+               1583EA39108395BB00A3BC0C /* pppcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2BE062DD5DB00835B54 /* pppcontroller.h */; };
+               1583EA3A108395BB00A3BC0C /* SCPreferencesSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA3B108395BB00A3BC0C /* SCPreferencesGetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA3C108395BB00A3BC0C /* SCNetworkConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA3E108395BB00A3BC0C /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
+               1583EA3F108395BB00A3BC0C /* SCNetworkConnectionPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA40108395BB00A3BC0C /* SCPreferencesKeychainPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA41108395BB00A3BC0C /* SCSchemaDefinitionsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA42108395BB00A3BC0C /* SCNetworkSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA43108395BB00A3BC0C /* SCNetworkSignaturePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1583EA44108395BB00A3BC0C /* CaptiveNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A1FF3010597F17004C9CC9 /* CaptiveNetwork.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               1583EA4B108395BB00A3BC0C /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A6F7C20A4B266D00B907EA /* Localizable.strings */; };
+               1583EA4C108395BB00A3BC0C /* NetworkInterface.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1577253606EFBF3100D7B52B /* NetworkInterface.strings */; };
+               1583EA4D108395BB00A3BC0C /* NetworkConfiguration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */; };
+               1583EA4E108395BB00A3BC0C /* get-mobility-info in Resources */ = {isa = PBXBuildFile; fileRef = 15CFC229068B222F00123568 /* get-mobility-info */; };
+               1583EA50108395BB00A3BC0C /* SCSchemaDefinitions.c in Sources */ = {isa = PBXBuildFile; fileRef = 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */; };
+               1583EA51108395BB00A3BC0C /* SCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695005C0722B0099E85F /* SCD.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA52108395BB00A3BC0C /* SCDKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695205C0722B0099E85F /* SCDKeys.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA53108395BB00A3BC0C /* SCDPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695405C0722B0099E85F /* SCDPrivate.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA54108395BB00A3BC0C /* SCDPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695605C0722B0099E85F /* SCDPlugin.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA55108395BB00A3BC0C /* SCDOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695805C0722B0099E85F /* SCDOpen.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA56108395BB00A3BC0C /* SCDLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695A05C0722B0099E85F /* SCDLock.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA57108395BB00A3BC0C /* SCDUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695C05C0722B0099E85F /* SCDUnlock.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA58108395BB00A3BC0C /* SCDList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695E05C0722B0099E85F /* SCDList.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA59108395BB00A3BC0C /* SCDAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696005C0722B0099E85F /* SCDAdd.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA5A108395BB00A3BC0C /* SCDGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696405C0722B0099E85F /* SCDGet.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA5B108395BB00A3BC0C /* SCDSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696605C0722B0099E85F /* SCDSet.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA5C108395BB00A3BC0C /* SCDRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696805C0722B0099E85F /* SCDRemove.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA5D108395BB00A3BC0C /* SCDTouch.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696A05C0722B0099E85F /* SCDTouch.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA5E108395BB00A3BC0C /* SCDNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696C05C0722B0099E85F /* SCDNotify.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA5F108395BB00A3BC0C /* SCDNotifierSetKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696E05C0722B0099E85F /* SCDNotifierSetKeys.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA60108395BB00A3BC0C /* SCDNotifierAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697005C0722B0099E85F /* SCDNotifierAdd.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA61108395BB00A3BC0C /* SCDNotifierRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697205C0722B0099E85F /* SCDNotifierRemove.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA62108395BB00A3BC0C /* SCDNotifierGetChanges.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697405C0722B0099E85F /* SCDNotifierGetChanges.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA63108395BB00A3BC0C /* SCDNotifierWait.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697605C0722B0099E85F /* SCDNotifierWait.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA64108395BB00A3BC0C /* SCDNotifierInformViaCallback.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697805C0722B0099E85F /* SCDNotifierInformViaCallback.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA65108395BB00A3BC0C /* SCDNotifierInformViaMachPort.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697A05C0722B0099E85F /* SCDNotifierInformViaMachPort.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA66108395BB00A3BC0C /* SCDNotifierInformViaFD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697C05C0722B0099E85F /* SCDNotifierInformViaFD.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA67108395BB00A3BC0C /* SCDNotifierInformViaSignal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697E05C0722B0099E85F /* SCDNotifierInformViaSignal.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA68108395BB00A3BC0C /* SCDNotifierCancel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698005C0722B0099E85F /* SCDNotifierCancel.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA69108395BB00A3BC0C /* SCDSnapshot.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698205C0722B0099E85F /* SCDSnapshot.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA6A108395BB00A3BC0C /* SCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698405C0722B0099E85F /* SCP.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA6B108395BB00A3BC0C /* SCPOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698605C0722B0099E85F /* SCPOpen.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA6C108395BB00A3BC0C /* SCPLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698805C0722B0099E85F /* SCPLock.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA6D108395BB00A3BC0C /* SCPUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698A05C0722B0099E85F /* SCPUnlock.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA6E108395BB00A3BC0C /* SCPList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698C05C0722B0099E85F /* SCPList.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA6F108395BB00A3BC0C /* SCPGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698E05C0722B0099E85F /* SCPGet.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA70108395BB00A3BC0C /* SCPAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699005C0722B0099E85F /* SCPAdd.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA71108395BB00A3BC0C /* SCPSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699205C0722B0099E85F /* SCPSet.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA72108395BB00A3BC0C /* SCPRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699405C0722B0099E85F /* SCPRemove.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA73108395BB00A3BC0C /* SCPCommit.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699605C0722B0099E85F /* SCPCommit.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA74108395BB00A3BC0C /* SCPApply.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699805C0722B0099E85F /* SCPApply.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA75108395BB00A3BC0C /* SCPPath.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699A05C0722B0099E85F /* SCPPath.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA76108395BB00A3BC0C /* SCDHostName.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699E05C0722B0099E85F /* SCDHostName.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA77108395BB00A3BC0C /* SCLocation.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A005C0722B0099E85F /* SCLocation.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA78108395BB00A3BC0C /* SCNetwork.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A205C0722B0099E85F /* SCNetwork.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA79108395BB00A3BC0C /* pppcontroller.defs in Sources */ = {isa = PBXBuildFile; fileRef = 23C1E2B8062DD45900835B54 /* pppcontroller.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               1583EA7A108395BB00A3BC0C /* SCNetworkConnection.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A405C0722B0099E85F /* SCNetworkConnection.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA7B108395BB00A3BC0C /* SCNetworkConnectionPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */; };
+               1583EA7C108395BB00A3BC0C /* SCNetworkReachability.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A605C0722B0099E85F /* SCNetworkReachability.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA7D108395BB00A3BC0C /* SCProxies.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A805C0722B0099E85F /* SCProxies.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA7E108395BB00A3BC0C /* DHCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AC05C0722B0099E85F /* DHCP.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA7F108395BB00A3BC0C /* moh.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AE05C0722B0099E85F /* moh.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA80108395BB00A3BC0C /* DeviceOnHold.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B005C0722B0099E85F /* DeviceOnHold.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA81108395BB00A3BC0C /* LinkConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B205C0722B0099E85F /* LinkConfiguration.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA82108395BB00A3BC0C /* dy_framework.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B405C0722B0099E85F /* dy_framework.c */; settings = {ATTRIBUTES = (); }; };
+               1583EA83108395BB00A3BC0C /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               1583EA84108395BB00A3BC0C /* SCPreferencesPathKey.c in Sources */ = {isa = PBXBuildFile; fileRef = 151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */; };
+               1583EA85108395BB00A3BC0C /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               1583EA86108395BB00A3BC0C /* SCNetworkConfigurationInternal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */; };
+               1583EA87108395BB00A3BC0C /* SCNetworkInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */; };
+               1583EA88108395BB00A3BC0C /* SCNetworkProtocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */; };
+               1583EA89108395BB00A3BC0C /* SCNetworkService.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */; };
+               1583EA8A108395BB00A3BC0C /* SCNetworkSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */; };
+               1583EA8C108395BB00A3BC0C /* SCHelper_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */; };
+               1583EA8D108395BB00A3BC0C /* SCPreferencesKeychainPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */; };
+               1583EA8E108395BB00A3BC0C /* SCNetworkSignature.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */; };
+               1583EA8F108395BB00A3BC0C /* CaptiveNetwork.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A1FF3110597F17004C9CC9 /* CaptiveNetwork.c */; };
+               1583EA94108395BB00A3BC0C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               1583EA9E108395BB00A3BC0C /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
+               1583EAA0108395BB00A3BC0C /* SCHelper_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D908466D4900D1B2BD /* SCHelper_server.c */; };
+               1583EAA2108395BB00A3BC0C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               1583EAA3108395BB00A3BC0C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; };
+               1583EAA4108395BB00A3BC0C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
+               1583EAA6108395BB00A3BC0C /* com.apple.SCHelper-embedded.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 151356AD0CE0CF2F0017E523 /* com.apple.SCHelper-embedded.plist */; };
+               1583EACC108395BB00A3BC0C /* dns-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22380AF13A7300D52ED0 /* dns-configuration.h */; };
+               1583EACD108395BB00A3BC0C /* set-hostname.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22390AF13A7300D52ED0 /* set-hostname.h */; };
+               1583EACE108395BB00A3BC0C /* dnsinfo_create.h in Headers */ = {isa = PBXBuildFile; fileRef = 1532629006281C9D00B1C10C /* dnsinfo_create.h */; };
+               1583EAD0108395BB00A3BC0C /* ip_plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53A707528B36004F8947 /* ip_plugin.c */; };
+               1583EAD1108395BB00A3BC0C /* dns-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AA07528B36004F8947 /* dns-configuration.c */; };
+               1583EAD2108395BB00A3BC0C /* set-hostname.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AB07528B36004F8947 /* set-hostname.c */; };
+               1583EAD3108395BB00A3BC0C /* dnsinfo_create.c in Sources */ = {isa = PBXBuildFile; fileRef = 1521FC5C060F296A003B28F5 /* dnsinfo_create.c */; };
+               1583EAD4108395BB00A3BC0C /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; };
+               1583EAE3108395BB00A3BC0C /* ifnamer.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AE07528B36004F8947 /* ifnamer.c */; };
+               1583EAF1108395BC00A3BC0C /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53CB07528B36004F8947 /* cache.h */; };
+               1583EAF2108395BC00A3BC0C /* ev_dlil.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B207528B36004F8947 /* ev_dlil.h */; };
+               1583EAF3108395BC00A3BC0C /* ev_ipv4.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B807528B36004F8947 /* ev_ipv4.h */; };
+               1583EAF4108395BC00A3BC0C /* ev_ipv6.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53BA07528B36004F8947 /* ev_ipv6.h */; };
+               1583EAF5108395BC00A3BC0C /* eventmon.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B707528B36004F8947 /* eventmon.h */; };
+               1583EAF7108395BC00A3BC0C /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; };
+               1583EAF8108395BC00A3BC0C /* ev_dlil.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B107528B36004F8947 /* ev_dlil.c */; };
+               1583EAF9108395BC00A3BC0C /* ev_ipv4.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B307528B36004F8947 /* ev_ipv4.c */; };
+               1583EAFA108395BC00A3BC0C /* ev_ipv6.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B407528B36004F8947 /* ev_ipv6.c */; };
+               1583EAFB108395BC00A3BC0C /* eventmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B007528B36004F8947 /* eventmon.c */; };
+               1583EB0A108395BC00A3BC0C /* linkconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C107528B36004F8947 /* linkconfig.c */; };
+               1583EB18108395BC00A3BC0C /* logger.c in Sources */ = {isa = PBXBuildFile; fileRef = 1531D3DB0E93E6DA00248432 /* logger.c */; };
+               1583EB1A108395BC00A3BC0C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               1583EB1B108395BC00A3BC0C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; };
+               1583EB1C108395BC00A3BC0C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
+               1583EB26108395BD00A3BC0C /* NetworkIdentification.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A680B03F97800993BA3 /* NetworkIdentification.c */; };
+               1583EB35108395BD00A3BC0C /* prefsmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C307528B36004F8947 /* prefsmon.c */; };
+               1583EB4D108395BD00A3BC0C /* configd.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69CF05C0722B0099E85F /* configd.h */; };
+               1583EB4E108395BD00A3BC0C /* _SCD.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D105C0722B0099E85F /* _SCD.h */; };
+               1583EB4F108395BD00A3BC0C /* configd_server.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D305C0722B0099E85F /* configd_server.h */; };
+               1583EB50108395BD00A3BC0C /* notify_server.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D505C0722B0099E85F /* notify_server.h */; };
+               1583EB51108395BD00A3BC0C /* plugin_support.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D705C0722B0099E85F /* plugin_support.h */; };
+               1583EB52108395BD00A3BC0C /* session.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D905C0722B0099E85F /* session.h */; };
+               1583EB53108395BD00A3BC0C /* pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69DB05C0722B0099E85F /* pattern.h */; };
+               1583EB55108395BD00A3BC0C /* configd.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E005C0722B0099E85F /* configd.m */; settings = {ATTRIBUTES = (); }; };
+               1583EB56108395BD00A3BC0C /* _SCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E205C0722B0099E85F /* _SCD.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB57108395BD00A3BC0C /* configd_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E405C0722B0099E85F /* configd_server.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB58108395BD00A3BC0C /* notify_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E605C0722B0099E85F /* notify_server.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB59108395BD00A3BC0C /* plugin_support.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E805C0722B0099E85F /* plugin_support.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB5A108395BD00A3BC0C /* session.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69EA05C0722B0099E85F /* session.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB5B108395BD00A3BC0C /* pattern.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69EC05C0722B0099E85F /* pattern.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB5C108395BD00A3BC0C /* _configopen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F005C0722B0099E85F /* _configopen.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB5D108395BD00A3BC0C /* _configclose.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F205C0722B0099E85F /* _configclose.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB5E108395BD00A3BC0C /* _configlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F405C0722B0099E85F /* _configlock.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB5F108395BD00A3BC0C /* _configunlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F605C0722B0099E85F /* _configunlock.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB60108395BD00A3BC0C /* _configlist.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F805C0722B0099E85F /* _configlist.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB61108395BD00A3BC0C /* _configadd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69FA05C0722B0099E85F /* _configadd.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB62108395BD00A3BC0C /* _configget.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69FE05C0722B0099E85F /* _configget.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB63108395BD00A3BC0C /* _configset.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0005C0722B0099E85F /* _configset.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB64108395BD00A3BC0C /* _configremove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0205C0722B0099E85F /* _configremove.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB65108395BD00A3BC0C /* _configtouch.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0405C0722B0099E85F /* _configtouch.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB66108395BD00A3BC0C /* _confignotify.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0605C0722B0099E85F /* _confignotify.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB67108395BD00A3BC0C /* _notifyadd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0805C0722B0099E85F /* _notifyadd.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB68108395BD00A3BC0C /* _notifyremove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0A05C0722B0099E85F /* _notifyremove.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB69108395BD00A3BC0C /* _notifychanges.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0C05C0722B0099E85F /* _notifychanges.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB6A108395BD00A3BC0C /* _notifyviaport.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0E05C0722B0099E85F /* _notifyviaport.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB6B108395BD00A3BC0C /* _notifyviafd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1005C0722B0099E85F /* _notifyviafd.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB6C108395BD00A3BC0C /* _notifyviasignal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1205C0722B0099E85F /* _notifyviasignal.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB6D108395BD00A3BC0C /* _notifycancel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1405C0722B0099E85F /* _notifycancel.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB6E108395BD00A3BC0C /* _snapshot.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1605C0722B0099E85F /* _snapshot.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB6F108395BD00A3BC0C /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+               1583EB70108395BD00A3BC0C /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
+               1583EB71108395BD00A3BC0C /* dnsinfo_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0D05FD1B670096477F /* dnsinfo_server.c */; };
+               1583EB72108395BD00A3BC0C /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+               1583EB74108395BD00A3BC0C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               1583EB75108395BD00A3BC0C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; };
+               1583EB76108395BD00A3BC0C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
+               1583EB77108395BD00A3BC0C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
+               1583EB78108395BD00A3BC0C /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15BAA32207F0699A00D9EC95 /* libbsm.dylib */; };
+               1583EB79108395BD00A3BC0C /* libKernelEventMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */; };
+               1583EB7A108395BD00A3BC0C /* libInterfaceNamer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */; };
+               1583EB7B108395BD00A3BC0C /* libIPMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53EC07528C61004F8947 /* libIPMonitor.a */; };
+               1583EB7C108395BD00A3BC0C /* libLinkConfiguration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53F307528C79004F8947 /* libLinkConfiguration.a */; };
+               1583EB7D108395BD00A3BC0C /* libNetworkIdentification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */; };
+               1583EB7E108395BD00A3BC0C /* libPreferencesMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */; };
+               1583EB80108395BD00A3BC0C /* com.apple.configd.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1540E3600987DA9500157C07 /* com.apple.configd.plist */; };
+               1583EB89108395BE00A3BC0C /* scselect.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A2E05C0722B0099E85F /* scselect.c */; settings = {ATTRIBUTES = (); }; };
+               1583EB8B108395BE00A3BC0C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               1583EB8C108395BE00A3BC0C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; };
+               1583EB94108395BE00A3BC0C /* scutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4305C0722B0099E85F /* scutil.h */; };
+               1583EB95108395BE00A3BC0C /* commands.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4505C0722B0099E85F /* commands.h */; };
+               1583EB96108395BE00A3BC0C /* dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4705C0722B0099E85F /* dictionary.h */; };
+               1583EB97108395BE00A3BC0C /* session.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4905C0722B0099E85F /* session.h */; };
+               1583EB98108395BE00A3BC0C /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4B05C0722B0099E85F /* cache.h */; };
+               1583EB99108395BE00A3BC0C /* notifications.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4D05C0722B0099E85F /* notifications.h */; };
+               1583EB9A108395BE00A3BC0C /* tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4F05C0722B0099E85F /* tests.h */; };
+               1583EB9B108395BE00A3BC0C /* prefs.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A5105C0722B0099E85F /* prefs.h */; };
+               1583EB9C108395BE00A3BC0C /* net.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A509A406C2518F001F0AB7 /* net.h */; };
+               1583EB9D108395BE00A3BC0C /* net_interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC34680711D49400A3311C /* net_interface.h */; };
+               1583EB9E108395BE00A3BC0C /* net_protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346A0711D49400A3311C /* net_protocol.h */; };
+               1583EB9F108395BE00A3BC0C /* net_service.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346C0711D49400A3311C /* net_service.h */; };
+               1583EBA0108395BE00A3BC0C /* net_set.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346E0711D49400A3311C /* net_set.h */; };
+               1583EBA2108395BE00A3BC0C /* scutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5405C0722B0099E85F /* scutil.c */; settings = {ATTRIBUTES = (); }; };
+               1583EBA3108395BE00A3BC0C /* commands.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5605C0722B0099E85F /* commands.c */; settings = {ATTRIBUTES = (); }; };
+               1583EBA4108395BE00A3BC0C /* dictionary.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5805C0722B0099E85F /* dictionary.c */; settings = {ATTRIBUTES = (); }; };
+               1583EBA5108395BE00A3BC0C /* session.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5A05C0722B0099E85F /* session.c */; settings = {ATTRIBUTES = (); }; };
+               1583EBA6108395BE00A3BC0C /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5C05C0722B0099E85F /* cache.c */; settings = {ATTRIBUTES = (); }; };
+               1583EBA7108395BE00A3BC0C /* notifications.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5E05C0722B0099E85F /* notifications.c */; settings = {ATTRIBUTES = (); }; };
+               1583EBA8108395BE00A3BC0C /* tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A6005C0722B0099E85F /* tests.c */; settings = {ATTRIBUTES = (); }; };
+               1583EBA9108395BE00A3BC0C /* prefs.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A6205C0722B0099E85F /* prefs.c */; settings = {ATTRIBUTES = (); }; };
+               1583EBAA108395BE00A3BC0C /* net.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A509A306C2518F001F0AB7 /* net.c */; };
+               1583EBAB108395BE00A3BC0C /* net_interface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC34670711D49400A3311C /* net_interface.c */; };
+               1583EBAC108395BE00A3BC0C /* net_protocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC34690711D49400A3311C /* net_protocol.c */; };
+               1583EBAD108395BE00A3BC0C /* net_service.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC346B0711D49400A3311C /* net_service.c */; };
+               1583EBAE108395BE00A3BC0C /* net_set.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC346D0711D49400A3311C /* net_set.c */; };
+               1583EBB0108395BE00A3BC0C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               1583EBB1108395BE00A3BC0C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; };
+               1583EBB2108395BE00A3BC0C /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 152CEED0070CF6640050F23C /* libedit.dylib */; };
+               158E595E1107CAE40062081E /* helper.defs in Sources */ = {isa = PBXBuildFile; fileRef = 152E0E7E10FE820E00E402F2 /* helper.defs */; };
+               158E595F1107CAE80062081E /* helper.defs in Sources */ = {isa = PBXBuildFile; fileRef = 152E0E7E10FE820E00E402F2 /* helper.defs */; };
+               158E59601107CAF10062081E /* helper.defs in Sources */ = {isa = PBXBuildFile; fileRef = 152E0E7E10FE820E00E402F2 /* helper.defs */; };
+               158E59611107CAF40062081E /* helper.defs in Sources */ = {isa = PBXBuildFile; fileRef = 152E0E7E10FE820E00E402F2 /* helper.defs */; };
                15943D440E94081800B87535 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
+               159A751A107FEAA400A57EAB /* VPNPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 159A7513107FEAA400A57EAB /* VPNPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               159A751C107FEAA400A57EAB /* VPNConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 159A7515107FEAA400A57EAB /* VPNConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               159A751E107FEAA400A57EAB /* VPNPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 159A7517107FEAA400A57EAB /* VPNPrivate.c */; };
+               159A7520107FEAA400A57EAB /* VPNConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 159A7519107FEAA400A57EAB /* VPNConfiguration.c */; };
+               159A7521107FEAA400A57EAB /* VPNPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 159A7513107FEAA400A57EAB /* VPNPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               159A7523107FEAA400A57EAB /* VPNConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 159A7515107FEAA400A57EAB /* VPNConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               159A7525107FEAA400A57EAB /* VPNPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 159A7517107FEAA400A57EAB /* VPNPrivate.c */; };
+               159A7527107FEAA400A57EAB /* VPNConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 159A7519107FEAA400A57EAB /* VPNConfiguration.c */; };
+               159A7528107FEAA400A57EAB /* VPNPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 159A7513107FEAA400A57EAB /* VPNPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               159A752A107FEAA400A57EAB /* VPNConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 159A7515107FEAA400A57EAB /* VPNConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               159A752C107FEAA400A57EAB /* VPNPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 159A7517107FEAA400A57EAB /* VPNPrivate.c */; };
+               159A752E107FEAA400A57EAB /* VPNConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 159A7519107FEAA400A57EAB /* VPNConfiguration.c */; };
                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 */; };
                159D540D07528DAE004F8947 /* ev_dlil.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B107528B36004F8947 /* ev_dlil.c */; };
                159D54D207529FFF004F8947 /* libLinkConfiguration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53F307528C79004F8947 /* libLinkConfiguration.a */; };
                159D54D307529FFF004F8947 /* libPreferencesMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */; };
                159D54D607529FFF004F8947 /* configd.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15CB6A2005C0722B0099E85F /* configd.8 */; };
+               15A1FF3210597F17004C9CC9 /* CaptiveNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A1FF3010597F17004C9CC9 /* CaptiveNetwork.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15A1FF3310597F17004C9CC9 /* CaptiveNetwork.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A1FF3110597F17004C9CC9 /* CaptiveNetwork.c */; };
+               15A1FF3410597F17004C9CC9 /* CaptiveNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A1FF3010597F17004C9CC9 /* CaptiveNetwork.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15A1FF3510597F17004C9CC9 /* CaptiveNetwork.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A1FF3110597F17004C9CC9 /* CaptiveNetwork.c */; };
                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, ); }; };
                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, ); }; };
                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 */; };
+               15AAA7F4108E310700C2A607 /* VPNTunnelPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AAA7F1108E310700C2A607 /* VPNTunnelPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15AAA7F5108E310700C2A607 /* VPNTunnel.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AAA7F2108E310700C2A607 /* VPNTunnel.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15AAA7F6108E310700C2A607 /* VPNTunnel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AAA7F3108E310700C2A607 /* VPNTunnel.c */; };
+               15AAA7F7108E310700C2A607 /* VPNTunnelPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AAA7F1108E310700C2A607 /* VPNTunnelPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15AAA7F8108E310700C2A607 /* VPNTunnel.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AAA7F2108E310700C2A607 /* VPNTunnel.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15AAA7F9108E310700C2A607 /* VPNTunnel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AAA7F3108E310700C2A607 /* VPNTunnel.c */; };
+               15B274A5114467CD003414AD /* nc.c in Sources */ = {isa = PBXBuildFile; fileRef = 72B43727113C7BFC00EBF1B6 /* nc.c */; };
+               15B274A6114467D8003414AD /* nc.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B43726113C7BFC00EBF1B6 /* nc.h */; };
                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 */; };
                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 */; };
+               15D9DCFB10DD90A1004E545D /* AppWorkaround.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15D9DCFA10DD90A1004E545D /* AppWorkaround.plist */; };
                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 */; };
                15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
                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 */; };
                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 */; };
                15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */; };
                15DAD69F07591A1A0084A6ED /* VLANConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B605C0722B0099E85F /* VLANConfiguration.c */; settings = {ATTRIBUTES = (); COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
                15DAD6A007591A1A0084A6ED /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Client, ); }; };
                15DAD6A207591A1A0084A6ED /* SCPreferencesPathKey.c in Sources */ = {isa = PBXBuildFile; fileRef = 151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */; };
-               15DAD6A307591A1A0084A6ED /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
-               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 */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
                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"; }; };
                15DAD6AE07591A1A0084A6ED /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
-               15DAF2DA08466D4900D1B2BD /* helper_comm.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D608466D4900D1B2BD /* helper_comm.c */; };
-               15DAF2DB08466D4900D1B2BD /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; };
                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 */; };
+               15F21618110F823500E89CF7 /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15BAA32207F0699A00D9EC95 /* libbsm.dylib */; };
+               15F21619110F826800E89CF7 /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15BAA32207F0699A00D9EC95 /* libbsm.dylib */; };
                15FC130B0CCEA59E0013872C /* monitor.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FC130A0CCEA59E0013872C /* monitor.c */; };
                15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               15FD7B3C101E439200C56621 /* BridgeConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FD7B3B101E439200C56621 /* BridgeConfiguration.c */; };
                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 */; };
+               72B43728113C7BFC00EBF1B6 /* nc.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B43726113C7BFC00EBF1B6 /* nc.h */; };
+               72B43729113C7BFC00EBF1B6 /* nc.c in Sources */ = {isa = PBXBuildFile; fileRef = 72B43727113C7BFC00EBF1B6 /* nc.c */; };
+               72B4372A113C7BFC00EBF1B6 /* nc.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B43726113C7BFC00EBF1B6 /* nc.h */; };
+               72B4372B113C7BFC00EBF1B6 /* nc.c in Sources */ = {isa = PBXBuildFile; fileRef = 72B43727113C7BFC00EBF1B6 /* nc.c */; };
+               D6623873120B2AA7007F8E95 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
                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, ); }; };
                        remoteGlobalIDString = 15A5A1E40D5B94190087BDA0;
                        remoteInfo = "SystemConfiguration.framework-EmbeddedSimulator";
                };
+               15AC515710839608004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583E9FD108395BB00A3BC0C;
+                       remoteInfo = "configd_libSystem-EmbeddedOther";
+               };
+               15AC515A1083960E004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EA11108395BB00A3BC0C;
+                       remoteInfo = "configd_base-EmbeddedOther";
+               };
+               15AC515C10839613004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EAAC108395BB00A3BC0C;
+                       remoteInfo = "configd_plugins-EmbeddedOther";
+               };
+               15AC515E1083961E004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB41108395BD00A3BC0C;
+                       remoteInfo = "configd_executables-EmbeddedOther";
+               };
+               15AC516010839649004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EA04108395BB00A3BC0C;
+                       remoteInfo = "DNSConfiguration-EmbeddedOther";
+               };
+               15AC516210839666004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EA19108395BB00A3BC0C;
+                       remoteInfo = "SystemConfiguration.framework-EmbeddedOther";
+               };
+               15AC51641083966B004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EA9B108395BB00A3BC0C;
+                       remoteInfo = "SCHelper-EmbeddedOther";
+               };
+               15AC5169108396B7004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB92108395BE00A3BC0C;
+                       remoteInfo = "scutil-EmbeddedOther";
+               };
+               15AC516B108396B7004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB86108395BE00A3BC0C;
+                       remoteInfo = "scselect-EmbeddedOther";
+               };
+               15AC516D108396B7004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB4B108395BD00A3BC0C;
+                       remoteInfo = "configd-EmbeddedOther";
+               };
+               15AC5170108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB3A108395BD00A3BC0C;
+                       remoteInfo = "PreferencesMonitor.bundle-EmbeddedOther";
+               };
+               15AC5172108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB32108395BD00A3BC0C;
+                       remoteInfo = "PreferencesMonitor-EmbeddedOther";
+               };
+               15AC5174108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB2B108395BD00A3BC0C;
+                       remoteInfo = "NetworkIdentification.bundle-EmbeddedOther";
+               };
+               15AC5176108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB23108395BD00A3BC0C;
+                       remoteInfo = "NetworkIdentification-EmbeddedOther";
+               };
+               15AC5178108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB16108395BC00A3BC0C;
+                       remoteInfo = "Logger.bundle-EmbeddedOther";
+               };
+               15AC517A108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB0F108395BC00A3BC0C;
+                       remoteInfo = "LinkConfiguration.bundle-EmbeddedOther";
+               };
+               15AC517C108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB07108395BC00A3BC0C;
+                       remoteInfo = "LinkConfiguration-EmbeddedOther";
+               };
+               15AC517E108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EB00108395BC00A3BC0C;
+                       remoteInfo = "KernelEventMonitor.bundle-EmbeddedOther";
+               };
+               15AC5180108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EAEF108395BC00A3BC0C;
+                       remoteInfo = "KernelEventMonitor-EmbeddedOther";
+               };
+               15AC5182108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EAE8108395BC00A3BC0C;
+                       remoteInfo = "InterfaceNamer.bundle-EmbeddedOther";
+               };
+               15AC5184108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EAE0108395BB00A3BC0C;
+                       remoteInfo = "InterfaceNamer-EmbeddedOther";
+               };
+               15AC5186108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EAD9108395BB00A3BC0C;
+                       remoteInfo = "IPMonitor.bundle-EmbeddedOther";
+               };
+               15AC5188108396D2004A9ED5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583EACA108395BB00A3BC0C;
+                       remoteInfo = "IPMonitor-EmbeddedOther";
+               };
                15C64A210F684C4900D78394 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        );
                        runOnlyForDeploymentPostprocessing = 1;
                };
+               1583EAA5108395BB00A3BC0C /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /System/Library/LaunchDaemons;
+                       dstSubfolderSpec = 0;
+                       files = (
+                               1583EAA6108395BB00A3BC0C /* com.apple.SCHelper-embedded.plist in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
+               1583EB7F108395BD00A3BC0C /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /System/Library/LaunchDaemons;
+                       dstSubfolderSpec = 0;
+                       files = (
+                               1583EB80108395BD00A3BC0C /* com.apple.configd.plist in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
                159D54D507529FFF004F8947 /* CopyFiles */ = {
                        isa = PBXCopyFilesBuildPhase;
                        buildActionMask = 8;
                        );
                        runOnlyForDeploymentPostprocessing = 1;
                };
+               15D9DCF910DD909F004E545D /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /usr/local/AppSpecificWorkaround/SystemConfiguration;
+                       dstSubfolderSpec = 0;
+                       files = (
+                               15D9DCFB10DD90A1004E545D /* AppWorkaround.plist in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
                15FF5C380CDF778F00EEC8AA /* CopyFiles */ = {
                        isa = PBXCopyFilesBuildPhase;
                        buildActionMask = 8;
                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 = "<group>"; };
                152CEED0070CF6640050F23C /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.2.dylib; sourceTree = "<absolute>"; };
+               152E0E7E10FE820E00E402F2 /* helper.defs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.mig; name = helper.defs; path = SystemConfiguration.fproj/helper/helper.defs; sourceTree = "<group>"; };
+               152E0E8810FE824000E402F2 /* helper_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = helper_types.h; path = SystemConfiguration.fproj/helper/helper_types.h; sourceTree = "<group>"; };
                152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesKeychainPrivate.h; sourceTree = "<group>"; };
                152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCPreferencesKeychainPrivate.c; sourceTree = "<group>"; };
                1531D3DA0E93E6DA00248432 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Plugins/Logger/Info.plist; sourceTree = "<group>"; };
                1572EB7A0A506D3B00D02459 /* smb-configuration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "smb-configuration.c"; sourceTree = "<group>"; };
                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; };
+               1575FD2512CD15C60003D86E /* proxy-configuration.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "proxy-configuration.c"; sourceTree = "<group>"; };
+               1575FD2612CD15C60003D86E /* proxy-configuration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "proxy-configuration.h"; sourceTree = "<group>"; };
                1577252F06EFB96700D7B52B /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/NetworkInterface.strings; sourceTree = "<group>"; };
-               157A84E80D56C63900B6F1A0 /* libdnsinfo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdnsinfo.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               157A84E80D56C63900B6F1A0 /* libdnsinfo.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdnsinfo.dylib; 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; };
                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 = "<group>"; };
                15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KernelEventMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
-               158AD85B0754E38F00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+               1583EA10108395BB00A3BC0C /* dnsinfo.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = dnsinfo.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EA99108395BB00A3BC0C /* SystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EAAA108395BB00A3BC0C /* SCHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SCHelper; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EAD8108395BB00A3BC0C /* libIPMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIPMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EADE108395BB00A3BC0C /* IPMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IPMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EAE7108395BB00A3BC0C /* libInterfaceNamer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libInterfaceNamer.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EAED108395BC00A3BC0C /* InterfaceNamer.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InterfaceNamer.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EAFF108395BC00A3BC0C /* libKernelEventMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKernelEventMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EB05108395BC00A3BC0C /* KernelEventMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KernelEventMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EB0E108395BC00A3BC0C /* libLinkConfiguration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLinkConfiguration.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EB14108395BC00A3BC0C /* LinkConfiguration.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LinkConfiguration.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EB21108395BC00A3BC0C /* Logger.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Logger.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EB2A108395BD00A3BC0C /* libNetworkIdentification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNetworkIdentification.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EB30108395BD00A3BC0C /* NetworkIdentification.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetworkIdentification.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EB39108395BD00A3BC0C /* libPreferencesMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPreferencesMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EB3F108395BD00A3BC0C /* PreferencesMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PreferencesMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EB84108395BD00A3BC0C /* configd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = configd; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EB90108395BE00A3BC0C /* scselect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scselect; sourceTree = BUILT_PRODUCTS_DIR; };
+               1583EBB6108395BE00A3BC0C /* scutil */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scutil; sourceTree = BUILT_PRODUCTS_DIR; };
                158AD8700754E3D400124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
                158AD8C00754E3EF00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
                158AD9100754E40E00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
                158AD9F80754EA2F00124717 /* AppleTalk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppleTalk.framework; path = /System/Library/Frameworks/AppleTalk.framework; sourceTree = "<absolute>"; };
+               159A7513107FEAA400A57EAB /* VPNPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VPNPrivate.h; sourceTree = "<group>"; };
+               159A7515107FEAA400A57EAB /* VPNConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VPNConfiguration.h; sourceTree = "<group>"; };
+               159A7517107FEAA400A57EAB /* VPNPrivate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = VPNPrivate.c; sourceTree = "<group>"; };
+               159A7519107FEAA400A57EAB /* VPNConfiguration.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = VPNConfiguration.c; sourceTree = "<group>"; };
                159D53A707528B36004F8947 /* ip_plugin.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = ip_plugin.c; sourceTree = "<group>"; };
                159D53AA07528B36004F8947 /* dns-configuration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "dns-configuration.c"; sourceTree = "<group>"; };
                159D53AB07528B36004F8947 /* set-hostname.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "set-hostname.c"; sourceTree = "<group>"; };
                159D53B207528B36004F8947 /* ev_dlil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_dlil.h; sourceTree = "<group>"; };
                159D53B307528B36004F8947 /* ev_ipv4.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ev_ipv4.c; sourceTree = "<group>"; };
                159D53B407528B36004F8947 /* ev_ipv6.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ev_ipv6.c; sourceTree = "<group>"; };
-               159D53B607528B36004F8947 /* ev_appletalk.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_appletalk.h; sourceTree = "<group>"; };
                159D53B707528B36004F8947 /* eventmon.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = eventmon.h; sourceTree = "<group>"; };
                159D53B807528B36004F8947 /* ev_ipv4.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_ipv4.h; sourceTree = "<group>"; };
-               159D53B907528B36004F8947 /* ev_appletalk.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ev_appletalk.c; sourceTree = "<group>"; };
                159D53BA07528B36004F8947 /* ev_ipv6.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_ipv6.h; sourceTree = "<group>"; };
-               159D53BC07528B36004F8947 /* Kicker.xml */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Kicker.xml; sourceTree = "<group>"; };
-               159D53BD07528B36004F8947 /* enable-network */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = "enable-network"; sourceTree = "<group>"; };
-               159D53BE07528B36004F8947 /* kicker.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = kicker.c; sourceTree = "<group>"; };
                159D53C107528B36004F8947 /* linkconfig.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = linkconfig.c; sourceTree = "<group>"; };
                159D53C307528B36004F8947 /* prefsmon.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = prefsmon.c; sourceTree = "<group>"; };
-               159D53C507528B36004F8947 /* cfManager.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = cfManager.c; sourceTree = "<group>"; };
-               159D53C607528B36004F8947 /* cfManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cfManager.h; sourceTree = "<group>"; };
-               159D53C707528B36004F8947 /* atconfig.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = atconfig.c; sourceTree = "<group>"; };
                159D53CA07528B36004F8947 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = "<group>"; };
                159D53CB07528B36004F8947 /* cache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cache.h; sourceTree = "<group>"; };
                159D53D407528BDA004F8947 /* libKernelEventMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKernelEventMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
                159D53F307528C79004F8947 /* libLinkConfiguration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLinkConfiguration.a; sourceTree = BUILT_PRODUCTS_DIR; };
                159D53FA07528C95004F8947 /* libPreferencesMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPreferencesMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
                159D54D907529FFF004F8947 /* configd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = configd; sourceTree = BUILT_PRODUCTS_DIR; };
+               15A1FF3010597F17004C9CC9 /* CaptiveNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CaptiveNetwork.h; sourceTree = "<group>"; };
+               15A1FF3110597F17004C9CC9 /* CaptiveNetwork.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CaptiveNetwork.c; sourceTree = "<group>"; };
                15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkConnectionPrivate.c; sourceTree = "<group>"; };
                15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConnectionPrivate.h; sourceTree = "<group>"; };
                15A509A306C2518F001F0AB7 /* net.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = net.c; sourceTree = "<group>"; };
                15A509A406C2518F001F0AB7 /* net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = net.h; sourceTree = "<group>"; };
                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 = "<group>"; };
+               15AAA7F1108E310700C2A607 /* VPNTunnelPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VPNTunnelPrivate.h; sourceTree = "<group>"; };
+               15AAA7F2108E310700C2A607 /* VPNTunnel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VPNTunnel.h; sourceTree = "<group>"; };
+               15AAA7F3108E310700C2A607 /* VPNTunnel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = VPNTunnel.c; sourceTree = "<group>"; };
                15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfiguration.h; sourceTree = "<group>"; };
                15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkConfigurationInternal.c; sourceTree = "<group>"; };
                15AD7A3A0670A85900BFE03C /* SCNetworkConfigurationInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfigurationInternal.h; sourceTree = "<group>"; };
                15CB6A6A05C0722B0099E85F /* scutil.8 */ = {isa = PBXFileReference; explicitFileType = text.man; path = scutil.8; sourceTree = "<group>"; };
                15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
                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; };
-               15DAF2D608466D4900D1B2BD /* helper_comm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = helper_comm.c; path = helper/helper_comm.c; sourceTree = "<group>"; };
-               15DAF2D708466D4900D1B2BD /* helper_comm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = helper_comm.h; path = helper/helper_comm.h; sourceTree = "<group>"; };
+               15D9DCFA10DD90A1004E545D /* AppWorkaround.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = AppWorkaround.plist; sourceTree = "<group>"; };
+               15DAD5EE075913CE0084A6ED /* libdnsinfo.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdnsinfo.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
                15DAF2D808466D4900D1B2BD /* SCHelper_client.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCHelper_client.c; path = helper/SCHelper_client.c; sourceTree = "<group>"; };
                15DAF2D908466D4900D1B2BD /* SCHelper_server.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCHelper_server.c; path = helper/SCHelper_server.c; sourceTree = "<group>"; };
                15DC34670711D49400A3311C /* net_interface.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = net_interface.c; sourceTree = "<group>"; };
                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 = "<group>"; };
                15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = IndigoSDK.xcconfig; path = /AppleInternal/Indigo/IndigoSDK.xcconfig; sourceTree = "<absolute>"; };
-               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; };
-               15FD73970754DE49001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
                15FD73EE0754DE62001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
                15FD743E0754DE7A001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+               15FD7B3B101E439200C56621 /* BridgeConfiguration.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = BridgeConfiguration.c; sourceTree = "<group>"; };
                15FEE80D0CCFD341001312F9 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
                15FEE8160CD03CA3001312F9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = SCMonitor/English.lproj/Localizable.strings; sourceTree = "<group>"; };
                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 = "<group>"; };
-               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 = "<absolute>"; };
+               23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 30; name = pppcontroller_types.h; path = usr/local/include/ppp/pppcontroller_types.h; sourceTree = SDKROOT; };
                23C1E2B8062DD45900835B54 /* pppcontroller.defs */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.mig; name = pppcontroller.defs; path = SystemConfiguration.fproj/pppcontroller.defs; sourceTree = "<group>"; };
                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; };
+               72B43726113C7BFC00EBF1B6 /* nc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nc.h; sourceTree = "<group>"; };
+               72B43727113C7BFC00EBF1B6 /* nc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nc.c; sourceTree = "<group>"; };
                9EE943F306AF409B00772EB5 /* BondConfiguration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = BondConfiguration.c; sourceTree = "<group>"; };
                F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkSignature.c; sourceTree = "<group>"; };
                F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkSignature.h; sourceTree = "<group>"; };
                                158337A00CFB6B9E0033AB93 /* CoreFoundation.framework in Frameworks */,
                                154707300D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */,
                                158337A20CFB6B9E0033AB93 /* Security.framework in Frameworks */,
+                               15F21618110F823500E89CF7 /* libbsm.dylib in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EA0C108395BB00A3BC0C /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EA93108395BB00A3BC0C /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EA94108395BB00A3BC0C /* CoreFoundation.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EAA1108395BB00A3BC0C /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EAA2108395BB00A3BC0C /* CoreFoundation.framework in Frameworks */,
+                               1583EAA3108395BB00A3BC0C /* SystemConfiguration.framework in Frameworks */,
+                               1583EAA4108395BB00A3BC0C /* Security.framework in Frameworks */,
+                               15F21619110F826800E89CF7 /* libbsm.dylib in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB19108395BC00A3BC0C /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EB1A108395BC00A3BC0C /* CoreFoundation.framework in Frameworks */,
+                               1583EB1B108395BC00A3BC0C /* SystemConfiguration.framework in Frameworks */,
+                               1583EB1C108395BC00A3BC0C /* IOKit.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB73108395BD00A3BC0C /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EB74108395BD00A3BC0C /* CoreFoundation.framework in Frameworks */,
+                               1583EB75108395BD00A3BC0C /* SystemConfiguration.framework in Frameworks */,
+                               1583EB76108395BD00A3BC0C /* IOKit.framework in Frameworks */,
+                               1583EB77108395BD00A3BC0C /* Security.framework in Frameworks */,
+                               1583EB78108395BD00A3BC0C /* libbsm.dylib in Frameworks */,
+                               1583EB79108395BD00A3BC0C /* libKernelEventMonitor.a in Frameworks */,
+                               1583EB7A108395BD00A3BC0C /* libInterfaceNamer.a in Frameworks */,
+                               1583EB7B108395BD00A3BC0C /* libIPMonitor.a in Frameworks */,
+                               1583EB7C108395BD00A3BC0C /* libLinkConfiguration.a in Frameworks */,
+                               1583EB7D108395BD00A3BC0C /* libNetworkIdentification.a in Frameworks */,
+                               1583EB7E108395BD00A3BC0C /* libPreferencesMonitor.a in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159C9B2F0DB68E8300BEEF10 /* Frameworks */ = {
+               1583EB8A108395BE00A3BC0C /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159C9B300DB68E8400BEEF10 /* CoreFoundation.framework in Frameworks */,
-                               159C9B7A0DB68E8A00BEEF10 /* SystemConfiguration.framework in Frameworks */,
+                               1583EB8B108395BE00A3BC0C /* CoreFoundation.framework in Frameworks */,
+                               1583EB8C108395BE00A3BC0C /* SystemConfiguration.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159C9B850DB68F0300BEEF10 /* Frameworks */ = {
+               1583EBAF108395BE00A3BC0C /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159C9B860DB68F1600BEEF10 /* CoreFoundation.framework in Frameworks */,
-                               159C9B870DB68F1600BEEF10 /* SystemConfiguration.framework in Frameworks */,
+                               1583EBB0108395BE00A3BC0C /* CoreFoundation.framework in Frameworks */,
+                               1583EBB1108395BE00A3BC0C /* SystemConfiguration.framework in Frameworks */,
+                               1583EBB2108395BE00A3BC0C /* libedit.dylib in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                159D54CC07529FFF004F8947 /* CoreFoundation.framework in Frameworks */,
                                1559C44A0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */,
                                1543636B0752D03C00A8EC6C /* IOKit.framework in Frameworks */,
+                               D6623873120B2AA7007F8E95 /* Security.framework in Frameworks */,
                                15BAA32307F0699A00D9EC95 /* libbsm.dylib in Frameworks */,
                                159D54CE07529FFF004F8947 /* libKernelEventMonitor.a in Frameworks */,
                                159D54D007529FFF004F8947 /* libInterfaceNamer.a in Frameworks */,
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+               1513E399108420A700088779 /* EmbeddedOther */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1583EA10108395BB00A3BC0C /* dnsinfo.dylib */,
+                               1583EA99108395BB00A3BC0C /* SystemConfiguration.framework */,
+                               1513E39D108420DE00088779 /* Plugins */,
+                               1583EAAA108395BB00A3BC0C /* SCHelper */,
+                               1513E3A11084216500088779 /* configd, scutil, scselect */,
+                       );
+                       name = EmbeddedOther;
+                       sourceTree = "<group>";
+               };
+               1513E39D108420DE00088779 /* Plugins */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1583EAD8108395BB00A3BC0C /* libIPMonitor.a */,
+                               1583EADE108395BB00A3BC0C /* IPMonitor.bundle */,
+                               1583EAE7108395BB00A3BC0C /* libInterfaceNamer.a */,
+                               1583EAED108395BC00A3BC0C /* InterfaceNamer.bundle */,
+                               1583EAFF108395BC00A3BC0C /* libKernelEventMonitor.a */,
+                               1583EB05108395BC00A3BC0C /* KernelEventMonitor.bundle */,
+                               1583EB0E108395BC00A3BC0C /* libLinkConfiguration.a */,
+                               1583EB14108395BC00A3BC0C /* LinkConfiguration.bundle */,
+                               1583EB21108395BC00A3BC0C /* Logger.bundle */,
+                               1583EB2A108395BD00A3BC0C /* libNetworkIdentification.a */,
+                               1583EB30108395BD00A3BC0C /* NetworkIdentification.bundle */,
+                               1583EB39108395BD00A3BC0C /* libPreferencesMonitor.a */,
+                               1583EB3F108395BD00A3BC0C /* PreferencesMonitor.bundle */,
+                       );
+                       name = Plugins;
+                       sourceTree = "<group>";
+               };
+               1513E3A11084216500088779 /* configd, scutil, scselect */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1583EB84108395BD00A3BC0C /* configd */,
+                               1583EB90108395BE00A3BC0C /* scselect */,
+                               1583EBB6108395BE00A3BC0C /* scutil */,
+                       );
+                       name = "configd, scutil, scselect";
+                       sourceTree = "<group>";
+               };
                151F5DA80CCE995D0093AC3B /* SCMonitor */ = {
                        isa = PBXGroup;
                        children = (
                154083530D5B824400E07907 /* MacOSX */ = {
                        isa = PBXGroup;
                        children = (
-                               15DAD5EE075913CE0084A6ED /* libdnsinfo.a */,
+                               15DAD5EE075913CE0084A6ED /* libdnsinfo.dylib */,
                                1547072E0D1F70C80075C28D /* SystemConfiguration.framework */,
                                1547001D08455B98006787CE /* SCHelper */,
                                151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */,
                1540835A0D5B825200E07907 /* Embedded */ = {
                        isa = PBXGroup;
                        children = (
-                               157A84E80D56C63900B6F1A0 /* libdnsinfo.a */,
+                               157A84E80D56C63900B6F1A0 /* libdnsinfo.dylib */,
                                1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */,
                                154083C50D5B832F00E07907 /* Plugins */,
                                1559C4470D349A4E0098FD59 /* SCHelper */,
                1547002F084561ED006787CE /* Headers */ = {
                        isa = PBXGroup;
                        children = (
-                               15DAF2D708466D4900D1B2BD /* helper_comm.h */,
                                155B7BF60847776D00F0E262 /* SCHelper_client.h */,
                        );
                        name = Headers;
                15470030084561FF006787CE /* Sources */ = {
                        isa = PBXGroup;
                        children = (
-                               15DAF2D608466D4900D1B2BD /* helper_comm.c */,
                                15DAF2D808466D4900D1B2BD /* SCHelper_client.c */,
                                15DAF2D908466D4900D1B2BD /* SCHelper_server.c */,
                        );
                158ADBFD0754ECB100124717 /* Plugins */ = {
                        isa = PBXGroup;
                        children = (
-                               15FD73220754DB9F001CC321 /* ATconfig.bundle */,
                                159D53EC07528C61004F8947 /* libIPMonitor.a */,
                                15FD72A50754DA4C001CC321 /* IPMonitor.bundle */,
                                159D53E507528C4A004F8947 /* libInterfaceNamer.a */,
                                15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */,
                                159D53D407528BDA004F8947 /* libKernelEventMonitor.a */,
                                15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */,
-                               15FD71090754D628001CC321 /* Kicker.bundle */,
                                159D53F307528C79004F8947 /* libLinkConfiguration.a */,
                                15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */,
                                F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */,
                        isa = PBXGroup;
                        children = (
                                159D53C907528B36004F8947 /* common */,
-                               159D53C407528B36004F8947 /* ATconfig */,
                                159D53A607528B36004F8947 /* IPMonitor */,
                                159D53AC07528B36004F8947 /* InterfaceNamer */,
                                159D53AF07528B36004F8947 /* KernelEventMonitor */,
-                               159D53BB07528B36004F8947 /* Kicker */,
                                159D53C007528B36004F8947 /* LinkConfiguration */,
                                1531D3D90E93E6AA00248432 /* Logger */,
                                F95B8A660B03F97800993BA3 /* NetworkIdentification */,
                                159D53A707528B36004F8947 /* ip_plugin.c */,
                                155D22380AF13A7300D52ED0 /* dns-configuration.h */,
                                159D53AA07528B36004F8947 /* dns-configuration.c */,
+                               1575FD2512CD15C60003D86E /* proxy-configuration.c */,
+                               1575FD2612CD15C60003D86E /* proxy-configuration.h */,
                                155D22390AF13A7300D52ED0 /* set-hostname.h */,
                                159D53AB07528B36004F8947 /* set-hostname.c */,
                                155D223A0AF13A7300D52ED0 /* smb-configuration.h */,
                        isa = PBXGroup;
                        children = (
                                159D53B707528B36004F8947 /* eventmon.h */,
-                               159D53B607528B36004F8947 /* ev_appletalk.h */,
                                159D53B207528B36004F8947 /* ev_dlil.h */,
                                159D53B807528B36004F8947 /* ev_ipv4.h */,
                                159D53BA07528B36004F8947 /* ev_ipv6.h */,
                                159D53B007528B36004F8947 /* eventmon.c */,
-                               159D53B907528B36004F8947 /* ev_appletalk.c */,
                                159D53B107528B36004F8947 /* ev_dlil.c */,
                                159D53B307528B36004F8947 /* ev_ipv4.c */,
                                159D53B407528B36004F8947 /* ev_ipv6.c */,
                        path = Plugins/KernelEventMonitor;
                        sourceTree = "<group>";
                };
-               159D53BB07528B36004F8947 /* Kicker */ = {
-                       isa = PBXGroup;
-                       children = (
-                               159D53BE07528B36004F8947 /* kicker.c */,
-                               158AD85B0754E38F00124717 /* Info.plist */,
-                               159D53BC07528B36004F8947 /* Kicker.xml */,
-                               159D53BD07528B36004F8947 /* enable-network */,
-                       );
-                       name = Kicker;
-                       path = Plugins/Kicker;
-                       sourceTree = "<group>";
-               };
                159D53C007528B36004F8947 /* LinkConfiguration */ = {
                        isa = PBXGroup;
                        children = (
                        path = Plugins/PreferencesMonitor;
                        sourceTree = "<group>";
                };
-               159D53C407528B36004F8947 /* ATconfig */ = {
-                       isa = PBXGroup;
-                       children = (
-                               159D53C507528B36004F8947 /* cfManager.c */,
-                               159D53C607528B36004F8947 /* cfManager.h */,
-                               159D53C707528B36004F8947 /* atconfig.c */,
-                               15FD73970754DE49001CC321 /* Info.plist */,
-                       );
-                       name = ATconfig;
-                       path = Plugins/ATconfig;
-                       sourceTree = "<group>";
-               };
                159D53C907528B36004F8947 /* common */ = {
                        isa = PBXGroup;
                        children = (
                15B6861D0678B61900FF4023 /* Supporting Files */ = {
                        isa = PBXGroup;
                        children = (
+                               15D9DCFA10DD90A1004E545D /* AppWorkaround.plist */,
                                15A6F7C20A4B266D00B907EA /* Localizable.strings */,
                                15B686220678B65C00FF4023 /* NetworkConfiguration.plist */,
                                1577253606EFBF3100D7B52B /* NetworkInterface.strings */,
                                154083530D5B824400E07907 /* MacOSX */,
                                1540835A0D5B825200E07907 /* Embedded */,
                                154083890D5B82A900E07907 /* EmbeddedSimulator */,
+                               1513E399108420A700088779 /* EmbeddedOther */,
                        );
                        name = Products;
                        sourceTree = "<group>";
                                F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */,
                                F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */,
                                15CB693905C0722B0099E85F /* SCValidation.h */,
+                               15A1FF3010597F17004C9CC9 /* CaptiveNetwork.h */,
                                15CB694505C0722B0099E85F /* DeviceOnHold.h */,
                                15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */,
                                15CB694705C0722B0099E85F /* LinkConfiguration.h */,
                                15CB694305C0722B0099E85F /* moh.h */,
                                15CB694105C0722B0099E85F /* moh_msg.h */,
                                23C1E2BE062DD5DB00835B54 /* pppcontroller.h */,
+                               159A7513107FEAA400A57EAB /* VPNPrivate.h */,
+                               159A7515107FEAA400A57EAB /* VPNConfiguration.h */,
+                               15AAA7F2108E310700C2A607 /* VPNTunnel.h */,
+                               15AAA7F1108E310700C2A607 /* VPNTunnelPrivate.h */,
                        );
                        name = Headers;
                        sourceTree = "<group>";
                                15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */,
                                15CB69B205C0722B0099E85F /* LinkConfiguration.c */,
                                9EE943F306AF409B00772EB5 /* BondConfiguration.c */,
+                               15FD7B3B101E439200C56621 /* BridgeConfiguration.c */,
                                15CB69B605C0722B0099E85F /* VLANConfiguration.c */,
                                15CB695605C0722B0099E85F /* SCDPlugin.c */,
                                15CB699C05C0722B0099E85F /* SCDConsoleUser.c */,
                                15CB69A605C0722B0099E85F /* SCNetworkReachability.c */,
                                F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */,
                                15CB69A805C0722B0099E85F /* SCProxies.c */,
+                               15A1FF3110597F17004C9CC9 /* CaptiveNetwork.c */,
                                15CB69AC05C0722B0099E85F /* DHCP.c */,
                                15CB69AE05C0722B0099E85F /* moh.c */,
                                15CB69B005C0722B0099E85F /* DeviceOnHold.c */,
                                15CB69B405C0722B0099E85F /* dy_framework.c */,
+                               159A7517107FEAA400A57EAB /* VPNPrivate.c */,
+                               159A7519107FEAA400A57EAB /* VPNConfiguration.c */,
+                               15AAA7F3108E310700C2A607 /* VPNTunnel.c */,
                        );
                        name = Sources;
                        sourceTree = "<group>";
                                15CB6A4D05C0722B0099E85F /* notifications.h */,
                                15CB6A4F05C0722B0099E85F /* tests.h */,
                                15CB6A5105C0722B0099E85F /* prefs.h */,
+                               72B43726113C7BFC00EBF1B6 /* nc.h */,
                                15A509A406C2518F001F0AB7 /* net.h */,
                                15DC34680711D49400A3311C /* net_interface.h */,
                                15DC346A0711D49400A3311C /* net_protocol.h */,
                                15CB6A5E05C0722B0099E85F /* notifications.c */,
                                15CB6A6005C0722B0099E85F /* tests.c */,
                                15CB6A6205C0722B0099E85F /* prefs.c */,
+                               72B43727113C7BFC00EBF1B6 /* nc.c */,
                                15A509A306C2518F001F0AB7 /* net.c */,
                                15DC34670711D49400A3311C /* net_interface.c */,
                                15DC34690711D49400A3311C /* net_protocol.c */,
                        children = (
                                15CB69BE05C0722B0099E85F /* config.defs */,
                                1514D76D05C08A5F00757DC9 /* config_types.h */,
+                               152E0E7E10FE820E00E402F2 /* helper.defs */,
+                               152E0E8810FE824000E402F2 /* helper_types.h */,
                                15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */,
                                15FCAACF05FD0EBF00CB79E6 /* shared_dns_info_types.h */,
                                23C1E2B8062DD45900835B54 /* pppcontroller.defs */,
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               15DAF2DF08466D4900D1B2BD /* helper_comm.h in Headers */,
                                155B7BF70847776D00F0E262 /* SCHelper_client.h in Headers */,
+                               152E0E8910FE824000E402F2 /* helper_types.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                155847510754FDCD0046C2E9 /* net_protocol.h in Headers */,
                                155847520754FDCD0046C2E9 /* net_service.h in Headers */,
                                155847530754FDCD0046C2E9 /* net_set.h in Headers */,
+                               72B43728113C7BFC00EBF1B6 /* nc.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                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 */,
+                               15A1FF3210597F17004C9CC9 /* CaptiveNetwork.h in Headers */,
+                               159A751A107FEAA400A57EAB /* VPNPrivate.h in Headers */,
+                               159A751C107FEAA400A57EAB /* VPNConfiguration.h in Headers */,
+                               15AAA7F5108E310700C2A607 /* VPNTunnel.h in Headers */,
+                               15AAA7F4108E310700C2A607 /* VPNTunnelPrivate.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                157433FC0D4A8137002ACA73 /* net_protocol.h in Headers */,
                                157433FD0D4A8137002ACA73 /* net_service.h in Headers */,
                                157433FE0D4A8137002ACA73 /* net_set.h in Headers */,
+                               72B4372A113C7BFC00EBF1B6 /* nc.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        buildActionMask = 2147483647;
                        files = (
                                157A84F60D56C7E800B6F1A0 /* dns-configuration.h in Headers */,
+                               1575FD2812CD15C60003D86E /* proxy-configuration.h in Headers */,
                                157A84F70D56C7E800B6F1A0 /* set-hostname.h in Headers */,
                                15D48EC20F67061F00B4711E /* dnsinfo_create.h in Headers */,
                        );
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               1583379B0CFB6B9E0033AB93 /* helper_comm.h in Headers */,
                                1583379C0CFB6B9E0033AB93 /* SCHelper_client.h in Headers */,
+                               152E0E8A10FE824000E402F2 /* helper_types.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159C9B2B0DB68E2600BEEF10 /* Headers */ = {
+               1583EA05108395BB00A3BC0C /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               1583EA06108395BB00A3BC0C /* dnsinfo.h in Headers */,
+                               1583EA07108395BB00A3BC0C /* dnsinfo_private.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159C9B830DB68F0300BEEF10 /* Headers */ = {
+               1583EA1A108395BB00A3BC0C /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               1583EA1B108395BB00A3BC0C /* SCSchemaDefinitions.h in Headers */,
+                               1583EA1C108395BB00A3BC0C /* SystemConfiguration.h in Headers */,
+                               1583EA1D108395BB00A3BC0C /* SCPrivate.h in Headers */,
+                               1583EA1E108395BB00A3BC0C /* SCDPlugin.h in Headers */,
+                               1583EA1F108395BB00A3BC0C /* SCDynamicStoreInternal.h in Headers */,
+                               1583EA20108395BB00A3BC0C /* SCDynamicStore.h in Headers */,
+                               1583EA21108395BB00A3BC0C /* SCDynamicStorePrivate.h in Headers */,
+                               1583EA22108395BB00A3BC0C /* SCDynamicStoreKey.h in Headers */,
+                               1583EA23108395BB00A3BC0C /* SCDynamicStoreCopySpecific.h in Headers */,
+                               1583EA24108395BB00A3BC0C /* SCDynamicStoreCopySpecificPrivate.h in Headers */,
+                               1583EA25108395BB00A3BC0C /* SCDynamicStoreSetSpecificPrivate.h in Headers */,
+                               1583EA26108395BB00A3BC0C /* SCPreferencesInternal.h in Headers */,
+                               1583EA27108395BB00A3BC0C /* SCPreferences.h in Headers */,
+                               1583EA28108395BB00A3BC0C /* SCPreferencesPrivate.h in Headers */,
+                               1583EA29108395BB00A3BC0C /* SCPreferencesPath.h in Headers */,
+                               1583EA2A108395BB00A3BC0C /* SCPreferencesSetSpecific.h in Headers */,
+                               1583EA2B108395BB00A3BC0C /* SCNetworkConfiguration.h in Headers */,
+                               1583EA2C108395BB00A3BC0C /* SCNetworkConfigurationInternal.h in Headers */,
+                               1583EA2D108395BB00A3BC0C /* SCNetwork.h in Headers */,
+                               1583EA2E108395BB00A3BC0C /* SCNetworkConnection.h in Headers */,
+                               1583EA2F108395BB00A3BC0C /* SCNetworkReachability.h in Headers */,
+                               1583EA30108395BB00A3BC0C /* SCValidation.h in Headers */,
+                               1583EA31108395BB00A3BC0C /* DHCPClientPreferences.h in Headers */,
+                               1583EA32108395BB00A3BC0C /* SCDynamicStoreCopyDHCPInfo.h in Headers */,
+                               1583EA33108395BB00A3BC0C /* moh_msg.h in Headers */,
+                               1583EA34108395BB00A3BC0C /* moh.h in Headers */,
+                               1583EA35108395BB00A3BC0C /* DeviceOnHold.h in Headers */,
+                               1583EA36108395BB00A3BC0C /* dy_framework.h in Headers */,
+                               1583EA37108395BB00A3BC0C /* SCPreferencesPathKey.h in Headers */,
+                               1583EA38108395BB00A3BC0C /* pppcontroller_types.h in Headers */,
+                               1583EA39108395BB00A3BC0C /* pppcontroller.h in Headers */,
+                               1583EA3A108395BB00A3BC0C /* SCPreferencesSetSpecificPrivate.h in Headers */,
+                               1583EA3B108395BB00A3BC0C /* SCPreferencesGetSpecificPrivate.h in Headers */,
+                               1583EA3C108395BB00A3BC0C /* SCNetworkConfigurationPrivate.h in Headers */,
+                               1583EA3E108395BB00A3BC0C /* SCHelper_client.h in Headers */,
+                               1583EA3F108395BB00A3BC0C /* SCNetworkConnectionPrivate.h in Headers */,
+                               1583EA40108395BB00A3BC0C /* SCPreferencesKeychainPrivate.h in Headers */,
+                               1583EA41108395BB00A3BC0C /* SCSchemaDefinitionsPrivate.h in Headers */,
+                               1583EA42108395BB00A3BC0C /* SCNetworkSignature.h in Headers */,
+                               1583EA43108395BB00A3BC0C /* SCNetworkSignaturePrivate.h in Headers */,
+                               1583EA44108395BB00A3BC0C /* CaptiveNetwork.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53D007528BDA004F8947 /* Headers */ = {
+               1583EA9C108395BB00A3BC0C /* 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 */,
+                               1583EA9E108395BB00A3BC0C /* SCHelper_client.h in Headers */,
+                               152E0E8B10FE824000E402F2 /* helper_types.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53E107528C4A004F8947 /* Headers */ = {
+               1583EACB108395BB00A3BC0C /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               1583EACC108395BB00A3BC0C /* dns-configuration.h in Headers */,
+                               1575FD2C12CD15C60003D86E /* proxy-configuration.h in Headers */,
+                               1583EACD108395BB00A3BC0C /* set-hostname.h in Headers */,
+                               1583EACE108395BB00A3BC0C /* dnsinfo_create.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53E807528C61004F8947 /* Headers */ = {
+               1583EAE1108395BB00A3BC0C /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               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;
                };
-               159D53EF07528C79004F8947 /* Headers */ = {
+               1583EAF0108395BC00A3BC0C /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               1583EAF1108395BC00A3BC0C /* cache.h in Headers */,
+                               1583EAF2108395BC00A3BC0C /* ev_dlil.h in Headers */,
+                               1583EAF3108395BC00A3BC0C /* ev_ipv4.h in Headers */,
+                               1583EAF4108395BC00A3BC0C /* ev_ipv6.h in Headers */,
+                               1583EAF5108395BC00A3BC0C /* eventmon.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53F607528C95004F8947 /* Headers */ = {
+               1583EB08108395BC00A3BC0C /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D54A307529FFF004F8947 /* Headers */ = {
+               1583EB24108395BD00A3BC0C /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159D54A407529FFF004F8947 /* configd.h in Headers */,
-                               159D54A507529FFF004F8947 /* _SCD.h in Headers */,
-                               159D54A607529FFF004F8947 /* configd_server.h in Headers */,
-                               159D54A707529FFF004F8947 /* notify_server.h in Headers */,
-                               159D54A807529FFF004F8947 /* plugin_support.h in Headers */,
-                               159D54A907529FFF004F8947 /* session.h in Headers */,
-                               159D54AA07529FFF004F8947 /* pattern.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15A5A1E60D5B94190087BDA0 /* Headers */ = {
+               1583EB33108395BD00A3BC0C /* 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 */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB4C108395BD00A3BC0C /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EB4D108395BD00A3BC0C /* configd.h in Headers */,
+                               1583EB4E108395BD00A3BC0C /* _SCD.h in Headers */,
+                               1583EB4F108395BD00A3BC0C /* configd_server.h in Headers */,
+                               1583EB50108395BD00A3BC0C /* notify_server.h in Headers */,
+                               1583EB51108395BD00A3BC0C /* plugin_support.h in Headers */,
+                               1583EB52108395BD00A3BC0C /* session.h in Headers */,
+                               1583EB53108395BD00A3BC0C /* pattern.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB87108395BE00A3BC0C /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB93108395BE00A3BC0C /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EB94108395BE00A3BC0C /* scutil.h in Headers */,
+                               1583EB95108395BE00A3BC0C /* commands.h in Headers */,
+                               1583EB96108395BE00A3BC0C /* dictionary.h in Headers */,
+                               1583EB97108395BE00A3BC0C /* session.h in Headers */,
+                               1583EB98108395BE00A3BC0C /* cache.h in Headers */,
+                               1583EB99108395BE00A3BC0C /* notifications.h in Headers */,
+                               1583EB9A108395BE00A3BC0C /* tests.h in Headers */,
+                               1583EB9B108395BE00A3BC0C /* prefs.h in Headers */,
+                               1583EB9C108395BE00A3BC0C /* net.h in Headers */,
+                               1583EB9D108395BE00A3BC0C /* net_interface.h in Headers */,
+                               1583EB9E108395BE00A3BC0C /* net_protocol.h in Headers */,
+                               1583EB9F108395BE00A3BC0C /* net_service.h in Headers */,
+                               1583EBA0108395BE00A3BC0C /* net_set.h in Headers */,
+                               15B274A6114467D8003414AD /* nc.h in Headers */,
+                       );
+                       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;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53E807528C61004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               155D223B0AF13A7300D52ED0 /* dns-configuration.h in Headers */,
+                               1575FD2A12CD15C60003D86E /* proxy-configuration.h in Headers */,
+                               155D223C0AF13A7300D52ED0 /* set-hostname.h in Headers */,
+                               155D223D0AF13A7300D52ED0 /* smb-configuration.h in Headers */,
+                               15D48EC00F67061700B4711E /* dnsinfo_create.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53EF07528C79004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53F607528C95004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D54A307529FFF004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D54A407529FFF004F8947 /* configd.h in Headers */,
+                               159D54A507529FFF004F8947 /* _SCD.h in Headers */,
+                               159D54A607529FFF004F8947 /* configd_server.h in Headers */,
+                               159D54A707529FFF004F8947 /* notify_server.h in Headers */,
+                               159D54A807529FFF004F8947 /* plugin_support.h in Headers */,
+                               159D54A907529FFF004F8947 /* session.h in Headers */,
+                               159D54AA07529FFF004F8947 /* pattern.h in Headers */,
+                       );
+                       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 */,
                                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 */,
+                               15A1FF3410597F17004C9CC9 /* CaptiveNetwork.h in Headers */,
+                               159A7528107FEAA400A57EAB /* VPNPrivate.h in Headers */,
+                               159A752A107FEAA400A57EAB /* VPNConfiguration.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                15DAD65D07591A1A0084A6ED /* LinkConfiguration.h in Headers */,
                                15DAD65E07591A1A0084A6ED /* dy_framework.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 */,
                                156BD6BC07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h in Headers */,
                                154CF3F407E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h in Headers */,
                                155A1E6C081079CC00F70D98 /* SCNetworkConfigurationPrivate.h in Headers */,
-                               15DAF2DB08466D4900D1B2BD /* helper_comm.h in Headers */,
                                155B7BF80847776D00F0E262 /* SCHelper_client.h in Headers */,
                                15A297300A13C08C009879B3 /* SCNetworkConnectionPrivate.h in Headers */,
                                152E68C10A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h in Headers */,
                                157A88890A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h in Headers */,
                                F95B8A460B03E09300993BA3 /* SCNetworkSignature.h in Headers */,
                                F95B8A470B03E09300993BA3 /* SCNetworkSignaturePrivate.h in Headers */,
+                               159A7521107FEAA400A57EAB /* VPNPrivate.h in Headers */,
+                               159A7523107FEAA400A57EAB /* VPNConfiguration.h in Headers */,
+                               15AAA7F8108E310700C2A607 /* VPNTunnel.h in Headers */,
+                               15AAA7F7108E310700C2A607 /* VPNTunnelPrivate.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        name = "DNSConfiguration-Embedded";
                        productInstallPath = /usr/local/lib/system;
                        productName = DNSConfiguration;
-                       productReference = 157A84E80D56C63900B6F1A0 /* libdnsinfo.a */;
-                       productType = "com.apple.product-type.library.static";
+                       productReference = 157A84E80D56C63900B6F1A0 /* libdnsinfo.dylib */;
+                       productType = "com.apple.product-type.library.dynamic";
                };
                157A84F40D56C7E800B6F1A0 /* IPMonitor-Embedded */ = {
                        isa = PBXNativeTarget;
                        productReference = 1559C4470D349A4E0098FD59 /* SCHelper */;
                        productType = "com.apple.product-type.tool";
                };
-               159D53D307528BDA004F8947 /* KernelEventMonitor */ = {
+               1583EA04108395BB00A3BC0C /* DNSConfiguration-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */;
+                       buildConfigurationList = 1583EA0D108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "DNSConfiguration-EmbeddedOther" */;
                        buildPhases = (
-                               159D53D007528BDA004F8947 /* Headers */,
-                               159D53D107528BDA004F8947 /* Sources */,
+                               1583EA05108395BB00A3BC0C /* Headers */,
+                               1583EA08108395BB00A3BC0C /* Sources */,
+                               1583EA0C108395BB00A3BC0C /* Frameworks */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = KernelEventMonitor;
-                       productName = KernelEventMonitor;
-                       productReference = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */;
-                       productType = "com.apple.product-type.library.static";
+                       name = "DNSConfiguration-EmbeddedOther";
+                       productInstallPath = /usr/local/lib/system;
+                       productName = DNSConfiguration;
+                       productReference = 1583EA10108395BB00A3BC0C /* dnsinfo.dylib */;
+                       productType = "com.apple.product-type.library.dynamic";
                };
-               159D53E407528C4A004F8947 /* InterfaceNamer */ = {
+               1583EA19108395BB00A3BC0C /* SystemConfiguration.framework-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */;
+                       buildConfigurationList = 1583EA96108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-EmbeddedOther" */;
                        buildPhases = (
-                               159D53E107528C4A004F8947 /* Headers */,
-                               159D53E207528C4A004F8947 /* Sources */,
+                               1583EA1A108395BB00A3BC0C /* Headers */,
+                               1583EA49108395BB00A3BC0C /* Update Headers */,
+                               1583EA4A108395BB00A3BC0C /* Resources */,
+                               1583EA4F108395BB00A3BC0C /* Sources */,
+                               1583EA93108395BB00A3BC0C /* Frameworks */,
+                               1583EA95108395BB00A3BC0C /* get-mobility-info */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = InterfaceNamer;
-                       productName = InterfaceNamer;
-                       productReference = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */;
-                       productType = "com.apple.product-type.library.static";
+                       name = "SystemConfiguration.framework-EmbeddedOther";
+                       productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                       productName = "SystemConfiguration (Framework)";
+                       productReference = 1583EA99108395BB00A3BC0C /* SystemConfiguration.framework */;
+                       productType = "com.apple.product-type.framework";
                };
-               159D53EB07528C61004F8947 /* IPMonitor */ = {
+               1583EA9B108395BB00A3BC0C /* SCHelper-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */;
+                       buildConfigurationList = 1583EAA7108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "SCHelper-EmbeddedOther" */;
                        buildPhases = (
-                               159D53E807528C61004F8947 /* Headers */,
-                               159D53E907528C61004F8947 /* Sources */,
+                               1583EA9C108395BB00A3BC0C /* Headers */,
+                               1583EA9F108395BB00A3BC0C /* Sources */,
+                               1583EAA1108395BB00A3BC0C /* Frameworks */,
+                               1583EAA5108395BB00A3BC0C /* CopyFiles */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = IPMonitor;
-                       productName = IPMonitor;
-                       productReference = 159D53EC07528C61004F8947 /* libIPMonitor.a */;
-                       productType = "com.apple.product-type.library.static";
+                       name = "SCHelper-EmbeddedOther";
+                       productInstallPath = /usr/local/bin;
+                       productName = SCPreferencesHelper;
+                       productReference = 1583EAAA108395BB00A3BC0C /* SCHelper */;
+                       productType = "com.apple.product-type.tool";
                };
-               159D53F207528C79004F8947 /* LinkConfiguration */ = {
+               1583EACA108395BB00A3BC0C /* IPMonitor-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */;
+                       buildConfigurationList = 1583EAD5108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "IPMonitor-EmbeddedOther" */;
                        buildPhases = (
-                               159D53EF07528C79004F8947 /* Headers */,
-                               159D53F007528C79004F8947 /* Sources */,
+                               1583EACB108395BB00A3BC0C /* Headers */,
+                               1583EACF108395BB00A3BC0C /* Sources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = LinkConfiguration;
-                       productName = LinkConfiguration;
-                       productReference = 159D53F307528C79004F8947 /* libLinkConfiguration.a */;
+                       name = "IPMonitor-EmbeddedOther";
+                       productName = IPMonitor;
+                       productReference = 1583EAD8108395BB00A3BC0C /* libIPMonitor.a */;
                        productType = "com.apple.product-type.library.static";
                };
-               159D53F907528C95004F8947 /* PreferencesMonitor */ = {
+               1583EAD9108395BB00A3BC0C /* IPMonitor.bundle-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */;
+                       buildConfigurationList = 1583EADB108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "IPMonitor.bundle-EmbeddedOther" */;
                        buildPhases = (
-                               159D53F607528C95004F8947 /* Headers */,
-                               159D53F707528C95004F8947 /* Sources */,
+                               1583EADA108395BB00A3BC0C /* Resources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = PreferencesMonitor;
-                       productName = PreferencesMonitor;
-                       productReference = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */;
-                       productType = "com.apple.product-type.library.static";
+                       name = "IPMonitor.bundle-EmbeddedOther";
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = IPMonitor.bundle;
+                       productReference = 1583EADE108395BB00A3BC0C /* IPMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
                };
-               159D549F07529FFF004F8947 /* configd */ = {
+               1583EAE0108395BB00A3BC0C /* InterfaceNamer-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB6220905594A00EEF749 /* Build configuration list for PBXNativeTarget "configd" */;
+                       buildConfigurationList = 1583EAE4108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "InterfaceNamer-EmbeddedOther" */;
                        buildPhases = (
-                               159D54A307529FFF004F8947 /* Headers */,
-                               159D54AB07529FFF004F8947 /* Sources */,
-                               159D54CA07529FFF004F8947 /* Frameworks */,
-                               159D54D507529FFF004F8947 /* CopyFiles */,
-                               159D54D707529FFF004F8947 /* CopyFiles */,
+                               1583EAE1108395BB00A3BC0C /* Headers */,
+                               1583EAE2108395BB00A3BC0C /* Sources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = configd;
-                       productInstallPath = /usr/sbin;
-                       productName = "configd (Tool)";
-                       productReference = 159D54D907529FFF004F8947 /* configd */;
-                       productType = "com.apple.product-type.tool";
+                       name = "InterfaceNamer-EmbeddedOther";
+                       productName = InterfaceNamer;
+                       productReference = 1583EAE7108395BB00A3BC0C /* libInterfaceNamer.a */;
+                       productType = "com.apple.product-type.library.static";
                };
-               15A5A1E40D5B94190087BDA0 /* SystemConfiguration.framework-EmbeddedSimulator */ = {
+               1583EAE8108395BC00A3BC0C /* InterfaceNamer.bundle-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 15A5A2660D5B94190087BDA0 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-EmbeddedSimulator" */;
+                       buildConfigurationList = 1583EAEA108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle-EmbeddedOther" */;
                        buildPhases = (
-                               15A5A1E60D5B94190087BDA0 /* Headers */,
-                               15A5A2170D5B94190087BDA0 /* Update Headers */,
-                               15A5A2180D5B94190087BDA0 /* Resources */,
-                               15A5A21D0D5B94190087BDA0 /* Sources */,
-                               15A5A2620D5B94190087BDA0 /* Frameworks */,
+                               1583EAE9108395BC00A3BC0C /* Resources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = "SystemConfiguration.framework-EmbeddedSimulator";
-                       productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
-                       productName = "SystemConfiguration (Framework)";
-                       productReference = 15A5A26A0D5B94190087BDA0 /* SystemConfiguration.framework */;
-                       productType = "com.apple.product-type.framework";
+                       name = "InterfaceNamer.bundle-EmbeddedOther";
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = InterfaceNamer.bundle;
+                       productReference = 1583EAED108395BC00A3BC0C /* InterfaceNamer.bundle */;
+                       productType = "com.apple.product-type.bundle";
                };
-               15DAD5DF075913CE0084A6ED /* DNSConfiguration */ = {
+               1583EAEF108395BC00A3BC0C /* KernelEventMonitor-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "DNSConfiguration" */;
+                       buildConfigurationList = 1583EAFC108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "KernelEventMonitor-EmbeddedOther" */;
                        buildPhases = (
-                               15DAD5E0075913CE0084A6ED /* Headers */,
-                               15DAD5E4075913CE0084A6ED /* Sources */,
-                               15DAD5E9075913CE0084A6ED /* Frameworks */,
+                               1583EAF0108395BC00A3BC0C /* Headers */,
+                               1583EAF6108395BC00A3BC0C /* Sources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = DNSConfiguration;
-                       productInstallPath = /usr/local/lib/system;
-                       productName = DNSConfiguration;
-                       productReference = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */;
+                       name = "KernelEventMonitor-EmbeddedOther";
+                       productName = KernelEventMonitor;
+                       productReference = 1583EAFF108395BC00A3BC0C /* libKernelEventMonitor.a */;
                        productType = "com.apple.product-type.library.static";
                };
-               15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */ = {
+               1583EB00108395BC00A3BC0C /* KernelEventMonitor.bundle-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB5DE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework" */;
+                       buildConfigurationList = 1583EB02108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle-EmbeddedOther" */;
                        buildPhases = (
-                               15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */,
-                               15DAD64107591A1A0084A6ED /* Headers */,
-                               15AC82480D376E2400A579D0 /* Update Headers */,
-                               15DAD66807591A1A0084A6ED /* Resources */,
-                               15DAD66C07591A1A0084A6ED /* Sources */,
-                               15DAD6AD07591A1A0084A6ED /* Frameworks */,
-                               15DAD6B007591A1A0084A6ED /* get-mobility-info */,
+                               1583EB01108395BC00A3BC0C /* Resources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = SystemConfiguration.framework;
-                       productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
-                       productName = "SystemConfiguration (Framework)";
-                       productReference = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */;
-                       productType = "com.apple.product-type.framework";
+                       name = "KernelEventMonitor.bundle-EmbeddedOther";
+                       productName = KernelEventMonitor.bundle;
+                       productReference = 1583EB05108395BC00A3BC0C /* KernelEventMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
                };
-               15FD70FF0754D627001CC321 /* Kicker.bundle */ = {
+               1583EB07108395BC00A3BC0C /* LinkConfiguration-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB60A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker.bundle" */;
+                       buildConfigurationList = 1583EB0B108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "LinkConfiguration-EmbeddedOther" */;
                        buildPhases = (
-                               159C9B830DB68F0300BEEF10 /* Headers */,
-                               159C9B840DB68F0300BEEF10 /* Sources */,
-                               159C9B850DB68F0300BEEF10 /* Frameworks */,
-                               15FD71010754D627001CC321 /* Resources */,
+                               1583EB08108395BC00A3BC0C /* Headers */,
+                               1583EB09108395BC00A3BC0C /* Sources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = Kicker.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
-                       productReference = 15FD71090754D628001CC321 /* Kicker.bundle */;
-                       productType = "com.apple.product-type.bundle";
+                       name = "LinkConfiguration-EmbeddedOther";
+                       productName = LinkConfiguration;
+                       productReference = 1583EB0E108395BC00A3BC0C /* libLinkConfiguration.a */;
+                       productType = "com.apple.product-type.library.static";
                };
-               15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */ = {
+               1583EB0F108395BC00A3BC0C /* LinkConfiguration.bundle-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB5FA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle" */;
+                       buildConfigurationList = 1583EB11108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle-EmbeddedOther" */;
                        buildPhases = (
-                               15FD72940754DA2B001CC321 /* Resources */,
+                               1583EB10108395BC00A3BC0C /* Resources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = InterfaceNamer.bundle;
+                       name = "LinkConfiguration.bundle-EmbeddedOther";
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = InterfaceNamer.bundle;
-                       productReference = 15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */;
+                       productName = LinkConfiguration.bundle;
+                       productReference = 1583EB14108395BC00A3BC0C /* LinkConfiguration.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
-               15FD72A10754DA4C001CC321 /* IPMonitor.bundle */ = {
+               1583EB16108395BC00A3BC0C /* Logger.bundle-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB5F20905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle" */;
+                       buildConfigurationList = 1583EB1E108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "Logger.bundle-EmbeddedOther" */;
                        buildPhases = (
-                               15FD72A20754DA4C001CC321 /* Resources */,
+                               1583EB17108395BC00A3BC0C /* Sources */,
+                               1583EB19108395BC00A3BC0C /* Frameworks */,
+                               1583EB1D108395BC00A3BC0C /* Resources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = IPMonitor.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = IPMonitor.bundle;
-                       productReference = 15FD72A50754DA4C001CC321 /* IPMonitor.bundle */;
+                       name = "Logger.bundle-EmbeddedOther";
+                       productName = Logger.bundle;
+                       productReference = 1583EB21108395BC00A3BC0C /* Logger.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
-               15FD72B10754DA69001CC321 /* LinkConfiguration.bundle */ = {
+               1583EB23108395BD00A3BC0C /* NetworkIdentification-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB6120905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle" */;
+                       buildConfigurationList = 1583EB27108395BD00A3BC0C /* Build configuration list for PBXNativeTarget "NetworkIdentification-EmbeddedOther" */;
                        buildPhases = (
-                               15FD72B20754DA69001CC321 /* Resources */,
+                               1583EB24108395BD00A3BC0C /* Headers */,
+                               1583EB25108395BD00A3BC0C /* Sources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = LinkConfiguration.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = LinkConfiguration.bundle;
-                       productReference = 15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */;
-                       productType = "com.apple.product-type.bundle";
+                       name = "NetworkIdentification-EmbeddedOther";
+                       productName = NetworkIdentification;
+                       productReference = 1583EB2A108395BD00A3BC0C /* libNetworkIdentification.a */;
+                       productType = "com.apple.product-type.library.static";
                };
-               15FD72C50754DA7E001CC321 /* PreferencesMonitor.bundle */ = {
+               1583EB2B108395BD00A3BC0C /* NetworkIdentification.bundle-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB61A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle" */;
+                       buildConfigurationList = 1583EB2D108395BD00A3BC0C /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle-EmbeddedOther" */;
                        buildPhases = (
-                               15FD72C60754DA7E001CC321 /* Resources */,
+                               1583EB2C108395BD00A3BC0C /* Resources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = PreferencesMonitor.bundle;
+                       name = "NetworkIdentification.bundle-EmbeddedOther";
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = PreferencesMonitor.bundle;
-                       productReference = 15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */;
+                       productName = NetworkIdentification.bundle;
+                       productReference = 1583EB30108395BD00A3BC0C /* NetworkIdentification.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
-               15FD731E0754DB9F001CC321 /* ATconfig.bundle */ = {
+               1583EB32108395BD00A3BC0C /* PreferencesMonitor-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB5EA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig.bundle" */;
+                       buildConfigurationList = 1583EB36108395BD00A3BC0C /* Build configuration list for PBXNativeTarget "PreferencesMonitor-EmbeddedOther" */;
                        buildPhases = (
-                               159C9B2B0DB68E2600BEEF10 /* Headers */,
-                               159C9B2C0DB68E2600BEEF10 /* Sources */,
-                               159C9B2F0DB68E8300BEEF10 /* Frameworks */,
-                               15FD731F0754DB9F001CC321 /* Resources */,
+                               1583EB33108395BD00A3BC0C /* Headers */,
+                               1583EB34108395BD00A3BC0C /* Sources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = ATconfig.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = ATconfig.bundle;
-                       productReference = 15FD73220754DB9F001CC321 /* ATconfig.bundle */;
-                       productType = "com.apple.product-type.bundle";
+                       name = "PreferencesMonitor-EmbeddedOther";
+                       productName = PreferencesMonitor;
+                       productReference = 1583EB39108395BD00A3BC0C /* libPreferencesMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
                };
-               F95B8A5E0B03F81400993BA3 /* NetworkIdentification */ = {
+               1583EB3A108395BD00A3BC0C /* PreferencesMonitor.bundle-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = F95B8A610B03F83200993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification" */;
+                       buildConfigurationList = 1583EB3C108395BD00A3BC0C /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle-EmbeddedOther" */;
                        buildPhases = (
-                               F95B8A5B0B03F81400993BA3 /* Headers */,
-                               F95B8A5C0B03F81400993BA3 /* Sources */,
+                               1583EB3B108395BD00A3BC0C /* Resources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = NetworkIdentification;
-                       productName = NetworkIdentification;
-                       productReference = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */;
-                       productType = "com.apple.product-type.library.static";
+                       name = "PreferencesMonitor.bundle-EmbeddedOther";
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = PreferencesMonitor.bundle;
+                       productReference = 1583EB3F108395BD00A3BC0C /* PreferencesMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
                };
-               F95B8A6A0B03F9D100993BA3 /* NetworkIdentification.bundle */ = {
+               1583EB4B108395BD00A3BC0C /* configd-EmbeddedOther */ = {
                        isa = PBXNativeTarget;
-                       buildConfigurationList = F95B8A6C0B03F9D100993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle" */;
+                       buildConfigurationList = 1583EB81108395BD00A3BC0C /* Build configuration list for PBXNativeTarget "configd-EmbeddedOther" */;
                        buildPhases = (
-                               F95B8A6B0B03F9D100993BA3 /* Resources */,
+                               1583EB4C108395BD00A3BC0C /* Headers */,
+                               1583EB54108395BD00A3BC0C /* Sources */,
+                               1583EB73108395BD00A3BC0C /* Frameworks */,
+                               1583EB7F108395BD00A3BC0C /* CopyFiles */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = NetworkIdentification.bundle;
-                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = NetworkIdentification.bundle;
-                       productReference = F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */;
-                       productType = "com.apple.product-type.bundle";
+                       name = "configd-EmbeddedOther";
+                       productInstallPath = /usr/sbin;
+                       productName = "configd (Tool)";
+                       productReference = 1583EB84108395BD00A3BC0C /* configd */;
+                       productType = "com.apple.product-type.tool";
                };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
-               15CB6A7705C0722B0099E85F /* Project object */ = {
-                       isa = PBXProject;
-                       buildConfigurationList = 156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */;
-                       compatibilityVersion = "Xcode 3.1";
-                       hasScannedForEncodings = 1;
-                       mainGroup = 15CB68FC05C072220099E85F /* configd */;
-                       productRefGroup = 15CB690F05C0722B0099E85F /* Products */;
-                       projectDirPath = "";
-                       projectRoot = "";
-                       targets = (
-                               15CB690005C0722A0099E85F /* All */,
-                               15C64A1E0F684C3300D78394 /* configd_libSystem */,
-                               15DAD5DF075913CE0084A6ED /* DNSConfiguration */,
-                               157BB8AE075924360025DA7A /* configd_base */,
-                               15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */,
-                               1547001808455B98006787CE /* SCHelper */,
-                               159D542007528E7C004F8947 /* configd_plugins */,
-                               15FD731E0754DB9F001CC321 /* ATconfig.bundle */,
-                               159D53EB07528C61004F8947 /* IPMonitor */,
-                               15FD72A10754DA4C001CC321 /* IPMonitor.bundle */,
-                               159D53E407528C4A004F8947 /* InterfaceNamer */,
-                               15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */,
-                               159D53D307528BDA004F8947 /* KernelEventMonitor */,
-                               15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */,
-                               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 */,
+               1583EB86108395BE00A3BC0C /* scselect-EmbeddedOther */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 1583EB8D108395BE00A3BC0C /* Build configuration list for PBXNativeTarget "scselect-EmbeddedOther" */;
+                       buildPhases = (
+                               1583EB87108395BE00A3BC0C /* Headers */,
+                               1583EB88108395BE00A3BC0C /* Sources */,
+                               1583EB8A108395BE00A3BC0C /* Frameworks */,
                        );
-               };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
-               151F5D960CCE98E50093AC3B /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                               15FEE81F0CD03E75001312F9 /* Localizable.strings in Resources */,
+                       buildRules = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15213FF60E93E9F500DACD2C /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
+                       name = "scselect-EmbeddedOther";
+                       productInstallPath = /usr/sbin;
+                       productName = "scselect (Tool)";
+                       productReference = 1583EB90108395BE00A3BC0C /* scselect */;
+                       productType = "com.apple.product-type.tool";
                };
-               156CA4810EF853BB00C59A18 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+               1583EB92108395BE00A3BC0C /* scutil-EmbeddedOther */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 1583EBB3108395BE00A3BC0C /* Build configuration list for PBXNativeTarget "scutil-EmbeddedOther" */;
+                       buildPhases = (
+                               1583EB93108395BE00A3BC0C /* Headers */,
+                               1583EBA1108395BE00A3BC0C /* Sources */,
+                               1583EBAF108395BE00A3BC0C /* Frameworks */,
                        );
-                       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 */,
+                       buildRules = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15828AE30753B5F900AD4710 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
+                       name = "scutil-EmbeddedOther";
+                       productInstallPath = /usr/sbin;
+                       productName = "scutil (Tool)";
+                       productReference = 1583EBB6108395BE00A3BC0C /* scutil */;
+                       productType = "com.apple.product-type.tool";
                };
-               1583177E0CFB85C8006F62B9 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+               159D53D307528BDA004F8947 /* KernelEventMonitor */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */;
+                       buildPhases = (
+                               159D53D007528BDA004F8947 /* Headers */,
+                               159D53D107528BDA004F8947 /* Sources */,
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               158317880CFB85DD006F62B9 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+                       buildRules = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               158317910CFB85F7006F62B9 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
+                       name = KernelEventMonitor;
+                       productName = KernelEventMonitor;
+                       productReference = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
                };
-               158317990CFB860C006F62B9 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+               159D53E407528C4A004F8947 /* InterfaceNamer */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */;
+                       buildPhases = (
+                               159D53E107528C4A004F8947 /* Headers */,
+                               159D53E207528C4A004F8947 /* Sources */,
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               158317A10CFB8626006F62B9 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+                       buildRules = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               158317A90CFB8639006F62B9 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
+                       name = InterfaceNamer;
+                       productName = InterfaceNamer;
+                       productReference = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */;
+                       productType = "com.apple.product-type.library.static";
                };
-               15A5A2180D5B94190087BDA0 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                               15A5A2190D5B94190087BDA0 /* Localizable.strings in Resources */,
-                               15A5A21A0D5B94190087BDA0 /* NetworkInterface.strings in Resources */,
-                               15A5A21B0D5B94190087BDA0 /* NetworkConfiguration.plist in Resources */,
+               159D53EB07528C61004F8947 /* IPMonitor */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */;
+                       buildPhases = (
+                               159D53E807528C61004F8947 /* Headers */,
+                               159D53E907528C61004F8947 /* Sources */,
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               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 */,
+                       buildRules = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD71010754D627001CC321 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                               158ADD190754F1F100124717 /* Kicker.xml in Resources */,
-                               158ADD1B0754F1F400124717 /* enable-network in Resources */,
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
+                       name = IPMonitor;
+                       productName = IPMonitor;
+                       productReference = 159D53EC07528C61004F8947 /* libIPMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
                };
-               15FD72940754DA2B001CC321 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+               159D53F207528C79004F8947 /* LinkConfiguration */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */;
+                       buildPhases = (
+                               159D53EF07528C79004F8947 /* Headers */,
+                               159D53F007528C79004F8947 /* Sources */,
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD72A20754DA4C001CC321 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+                       buildRules = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD72B20754DA69001CC321 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
+                       name = LinkConfiguration;
+                       productName = LinkConfiguration;
+                       productReference = 159D53F307528C79004F8947 /* libLinkConfiguration.a */;
+                       productType = "com.apple.product-type.library.static";
                };
-               15FD72C60754DA7E001CC321 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+               159D53F907528C95004F8947 /* PreferencesMonitor */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */;
+                       buildPhases = (
+                               159D53F607528C95004F8947 /* Headers */,
+                               159D53F707528C95004F8947 /* Sources */,
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15FD731F0754DB9F001CC321 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+                       buildRules = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               F95B8A6B0B03F9D100993BA3 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
+                       name = PreferencesMonitor;
+                       productName = PreferencesMonitor;
+                       productReference = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
                };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXShellScriptBuildPhase section */
-               151F63DB09328A3C0096DCC9 /* ShellScript */ = {
-                       isa = PBXShellScriptBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+               159D549F07529FFF004F8947 /* configd */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6220905594A00EEF749 /* Build configuration list for PBXNativeTarget "configd" */;
+                       buildPhases = (
+                               159D54A307529FFF004F8947 /* Headers */,
+                               159D54AB07529FFF004F8947 /* Sources */,
+                               159D54CA07529FFF004F8947 /* Frameworks */,
+                               159D54D507529FFF004F8947 /* CopyFiles */,
+                               159D54D707529FFF004F8947 /* CopyFiles */,
                        );
-                       inputPaths = (
-                               SystemConfiguration.fproj/genSCPreferences.c,
+                       buildRules = (
                        );
-                       outputPaths = (
-                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.h",
-                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitionsPrivate.h",
-                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.c",
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-                       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";
+                       name = configd;
+                       productInstallPath = /usr/sbin;
+                       productName = "configd (Tool)";
+                       productReference = 159D54D907529FFF004F8947 /* configd */;
+                       productType = "com.apple.product-type.tool";
                };
-               153393E40D34999D00FE74E7 /* Update Headers */ = {
-                       isa = PBXShellScriptBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+               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 */,
                        );
-                       inputPaths = (
-                               "$(SRCROOT)/SystemConfiguration.fproj/update-headers",
+                       buildRules = (
                        );
-                       name = "Update Headers";
-                       outputPaths = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-                       shellPath = /bin/sh;
-                       shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} split\nfi\n";
-                       showEnvVarsInLog = 0;
+                       name = "SystemConfiguration.framework-EmbeddedSimulator";
+                       productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                       productName = "SystemConfiguration (Framework)";
+                       productReference = 15A5A26A0D5B94190087BDA0 /* SystemConfiguration.framework */;
+                       productType = "com.apple.product-type.framework";
                };
-               1572C5270CFB55B400E2776E /* get-mobility-info */ = {
-                       isa = PBXShellScriptBuildPhase;
-                       buildActionMask = 8;
-                       files = (
+               15DAD5DF075913CE0084A6ED /* DNSConfiguration */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "DNSConfiguration" */;
+                       buildPhases = (
+                               15DAD5E0075913CE0084A6ED /* Headers */,
+                               15DAD5E4075913CE0084A6ED /* Sources */,
+                               15DAD5E9075913CE0084A6ED /* Frameworks */,
                        );
-                       inputPaths = (
+                       buildRules = (
                        );
-                       name = "get-mobility-info";
-                       outputPaths = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 1;
-                       shellPath = /bin/sh;
-                       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;
+                       name = DNSConfiguration;
+                       productInstallPath = /usr/local/lib/system;
+                       productName = DNSConfiguration;
+                       productReference = 15DAD5EE075913CE0084A6ED /* libdnsinfo.dylib */;
+                       productType = "com.apple.product-type.library.dynamic";
                };
-               15A5A2170D5B94190087BDA0 /* Update Headers */ = {
-                       isa = PBXShellScriptBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+               15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5DE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework" */;
+                       buildPhases = (
+                               15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */,
+                               15DAD64107591A1A0084A6ED /* Headers */,
+                               15AC82480D376E2400A579D0 /* Update Headers */,
+                               15DAD66807591A1A0084A6ED /* Resources */,
+                               15DAD66C07591A1A0084A6ED /* Sources */,
+                               15DAD6AD07591A1A0084A6ED /* Frameworks */,
+                               15DAD6B007591A1A0084A6ED /* get-mobility-info */,
+                               15D9DCF910DD909F004E545D /* CopyFiles */,
                        );
-                       inputPaths = (
-                               "$(SRCROOT)/SystemConfiguration.fproj/update-headers",
+                       buildRules = (
                        );
-                       name = "Update Headers";
-                       outputPaths = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-                       shellPath = /bin/sh;
-                       shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} split\nfi\n";
-                       showEnvVarsInLog = 0;
+                       name = SystemConfiguration.framework;
+                       productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                       productName = "SystemConfiguration (Framework)";
+                       productReference = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */;
+                       productType = "com.apple.product-type.framework";
                };
-               15AC82480D376E2400A579D0 /* Update Headers */ = {
-                       isa = PBXShellScriptBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+               15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5FA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle" */;
+                       buildPhases = (
+                               15FD72940754DA2B001CC321 /* Resources */,
                        );
-                       inputPaths = (
-                               "$(SRCROOT)/SystemConfiguration.fproj/update-headers",
+                       buildRules = (
                        );
-                       name = "Update Headers";
-                       outputPaths = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 0;
-                       shellPath = /bin/sh;
-                       shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} clean\nfi\n";
-                       showEnvVarsInLog = 0;
+                       name = InterfaceNamer.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = InterfaceNamer.bundle;
+                       productReference = 15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */;
+                       productType = "com.apple.product-type.bundle";
                };
-               15BED7930F6853F800016614 /* OLD libdnsinfo.a */ = {
-                       isa = PBXShellScriptBuildPhase;
-                       buildActionMask = 8;
-                       files = (
+               15FD72A10754DA4C001CC321 /* IPMonitor.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5F20905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle" */;
+                       buildPhases = (
+                               15FD72A20754DA4C001CC321 /* Resources */,
                        );
-                       inputPaths = (
+                       buildRules = (
                        );
-                       name = "OLD libdnsinfo.a";
-                       outputPaths = (
+                       dependencies = (
                        );
-                       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;
+                       name = IPMonitor.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = IPMonitor.bundle;
+                       productReference = 15FD72A50754DA4C001CC321 /* IPMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
                };
-               15BED7A20F68551200016614 /* OLD libdnsinfo.a */ = {
-                       isa = PBXShellScriptBuildPhase;
-                       buildActionMask = 8;
-                       files = (
+               15FD72B10754DA69001CC321 /* LinkConfiguration.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6120905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle" */;
+                       buildPhases = (
+                               15FD72B20754DA69001CC321 /* Resources */,
                        );
-                       inputPaths = (
+                       buildRules = (
                        );
-                       name = "OLD libdnsinfo.a";
-                       outputPaths = (
+                       dependencies = (
                        );
-                       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;
+                       name = LinkConfiguration.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = LinkConfiguration.bundle;
+                       productReference = 15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */;
+                       productType = "com.apple.product-type.bundle";
                };
-               15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */ = {
-                       isa = PBXShellScriptBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
+               15FD72C50754DA7E001CC321 /* PreferencesMonitor.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB61A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle" */;
+                       buildPhases = (
+                               15FD72C60754DA7E001CC321 /* Resources */,
                        );
-                       inputPaths = (
-                               /usr/local/lib/OrderFiles/SystemConfiguration.order,
+                       buildRules = (
                        );
-                       name = SystemConfiguration.order;
-                       outputPaths = (
-                               "${OBJROOT}/SystemConfiguration.order",
+                       dependencies = (
                        );
-                       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;
+                       name = PreferencesMonitor.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = PreferencesMonitor.bundle;
+                       productReference = 15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
                };
-               15DAD6B007591A1A0084A6ED /* get-mobility-info */ = {
-                       isa = PBXShellScriptBuildPhase;
-                       buildActionMask = 8;
-                       files = (
+               F95B8A5E0B03F81400993BA3 /* NetworkIdentification */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = F95B8A610B03F83200993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification" */;
+                       buildPhases = (
+                               F95B8A5B0B03F81400993BA3 /* Headers */,
+                               F95B8A5C0B03F81400993BA3 /* Sources */,
                        );
-                       inputPaths = (
+                       buildRules = (
                        );
-                       name = "get-mobility-info";
-                       outputPaths = (
+                       dependencies = (
                        );
-                       runOnlyForDeploymentPostprocessing = 1;
-                       shellPath = /bin/sh;
-                       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 */
+                       name = NetworkIdentification;
+                       productName = NetworkIdentification;
+                       productReference = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               F95B8A6A0B03F9D100993BA3 /* NetworkIdentification.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = F95B8A6C0B03F9D100993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle" */;
+                       buildPhases = (
+                               F95B8A6B0B03F9D100993BA3 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = NetworkIdentification.bundle;
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = NetworkIdentification.bundle;
+                       productReference = F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+/* End PBXNativeTarget section */
 
-/* Begin PBXSourcesBuildPhase section */
-               151F5D970CCE98E50093AC3B /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+/* Begin PBXProject section */
+               15CB6A7705C0722B0099E85F /* Project object */ = {
+                       isa = PBXProject;
+                       buildConfigurationList = 156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */;
+                       compatibilityVersion = "Xcode 3.1";
+                       developmentRegion = English;
+                       hasScannedForEncodings = 1;
+                       knownRegions = (
+                               English,
+                               Japanese,
+                               French,
+                               German,
+                       );
+                       mainGroup = 15CB68FC05C072220099E85F /* configd */;
+                       productRefGroup = 15CB690F05C0722B0099E85F /* Products */;
+                       projectDirPath = "";
+                       projectRoot = "";
+                       targets = (
+                               15CB690005C0722A0099E85F /* All */,
+                               15C64A1E0F684C3300D78394 /* configd_libSystem */,
+                               15DAD5DF075913CE0084A6ED /* DNSConfiguration */,
+                               157BB8AE075924360025DA7A /* configd_base */,
+                               15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */,
+                               1547001808455B98006787CE /* SCHelper */,
+                               159D542007528E7C004F8947 /* configd_plugins */,
+                               159D53EB07528C61004F8947 /* IPMonitor */,
+                               15FD72A10754DA4C001CC321 /* IPMonitor.bundle */,
+                               159D53E407528C4A004F8947 /* InterfaceNamer */,
+                               15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */,
+                               159D53D307528BDA004F8947 /* KernelEventMonitor */,
+                               15828AE60753B5F900AD4710 /* KernelEventMonitor.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 */,
+                               1583E9E01083959E00A3BC0C /* All-EmbeddedOther */,
+                               1583E9FD108395BB00A3BC0C /* configd_libSystem-EmbeddedOther */,
+                               1583EA04108395BB00A3BC0C /* DNSConfiguration-EmbeddedOther */,
+                               1583EA11108395BB00A3BC0C /* configd_base-EmbeddedOther */,
+                               1583EA19108395BB00A3BC0C /* SystemConfiguration.framework-EmbeddedOther */,
+                               1583EA9B108395BB00A3BC0C /* SCHelper-EmbeddedOther */,
+                               1583EAAC108395BB00A3BC0C /* configd_plugins-EmbeddedOther */,
+                               1583EACA108395BB00A3BC0C /* IPMonitor-EmbeddedOther */,
+                               1583EAD9108395BB00A3BC0C /* IPMonitor.bundle-EmbeddedOther */,
+                               1583EAE0108395BB00A3BC0C /* InterfaceNamer-EmbeddedOther */,
+                               1583EAE8108395BC00A3BC0C /* InterfaceNamer.bundle-EmbeddedOther */,
+                               1583EAEF108395BC00A3BC0C /* KernelEventMonitor-EmbeddedOther */,
+                               1583EB00108395BC00A3BC0C /* KernelEventMonitor.bundle-EmbeddedOther */,
+                               1583EB07108395BC00A3BC0C /* LinkConfiguration-EmbeddedOther */,
+                               1583EB0F108395BC00A3BC0C /* LinkConfiguration.bundle-EmbeddedOther */,
+                               1583EB16108395BC00A3BC0C /* Logger.bundle-EmbeddedOther */,
+                               1583EB23108395BD00A3BC0C /* NetworkIdentification-EmbeddedOther */,
+                               1583EB2B108395BD00A3BC0C /* NetworkIdentification.bundle-EmbeddedOther */,
+                               1583EB32108395BD00A3BC0C /* PreferencesMonitor-EmbeddedOther */,
+                               1583EB3A108395BD00A3BC0C /* PreferencesMonitor.bundle-EmbeddedOther */,
+                               1583EB41108395BD00A3BC0C /* configd_executables-EmbeddedOther */,
+                               1583EB4B108395BD00A3BC0C /* configd-EmbeddedOther */,
+                               1583EB86108395BE00A3BC0C /* scselect-EmbeddedOther */,
+                               1583EB92108395BE00A3BC0C /* scutil-EmbeddedOther */,
+                       );
+               };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+               151F5D960CCE98E50093AC3B /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               15FC130B0CCEA59E0013872C /* monitor.c in Sources */,
+                               15FEE81F0CD03E75001312F9 /* Localizable.strings in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15213FF70E93E9F500DACD2C /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               15213FF60E93E9F500DACD2C /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               152140020E93EC6500DACD2C /* logger.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               1547001A08455B98006787CE /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               156CA4810EF853BB00C59A18 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               15DAF2E108466D4900D1B2BD /* SCHelper_server.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               155847540754FDCD0046C2E9 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               1572C4D90CFB55B400E2776E /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               155847550754FDCD0046C2E9 /* scutil.c in Sources */,
-                               155847560754FDCD0046C2E9 /* commands.c in Sources */,
-                               155847570754FDCD0046C2E9 /* dictionary.c in Sources */,
-                               155847580754FDCD0046C2E9 /* session.c in Sources */,
-                               155847590754FDCD0046C2E9 /* cache.c in Sources */,
-                               1558475A0754FDCD0046C2E9 /* notifications.c in Sources */,
-                               1558475B0754FDCD0046C2E9 /* tests.c in Sources */,
-                               1558475C0754FDCD0046C2E9 /* prefs.c in Sources */,
-                               1558475D0754FDCD0046C2E9 /* net.c in Sources */,
-                               1558475E0754FDCD0046C2E9 /* net_interface.c in Sources */,
-                               1558475F0754FDCD0046C2E9 /* net_protocol.c in Sources */,
-                               155847600754FDCD0046C2E9 /* net_service.c in Sources */,
-                               155847610754FDCD0046C2E9 /* net_set.c in Sources */,
+                               1572C4DA0CFB55B400E2776E /* Localizable.strings in Resources */,
+                               1572C4DB0CFB55B400E2776E /* NetworkInterface.strings in Resources */,
+                               1572C4DC0CFB55B400E2776E /* NetworkConfiguration.plist in Resources */,
+                               1572C4DD0CFB55B400E2776E /* get-mobility-info in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               1558481507550EC10046C2E9 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               15828AE30753B5F900AD4710 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               1558481607550EC10046C2E9 /* scselect.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               156CA47A0EF853BB00C59A18 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               1583177E0CFB85C8006F62B9 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               156CA47B0EF853BB00C59A18 /* logger.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               1572C4DE0CFB55B400E2776E /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               158317880CFB85DD006F62B9 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        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;
+               158317910CFB85F7006F62B9 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               157433E00D4A8122002ACA73 /* scselect.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               157433FF0D4A8137002ACA73 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               158317990CFB860C006F62B9 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        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;
+               158317A10CFB8626006F62B9 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        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;
+               158317A90CFB8639006F62B9 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        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;
+               1583EA4A108395BB00A3BC0C /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               157A85080D56C8AA00B6F1A0 /* ifnamer.c in Sources */,
+                               1583EA4B108395BB00A3BC0C /* Localizable.strings in Resources */,
+                               1583EA4C108395BB00A3BC0C /* NetworkInterface.strings in Resources */,
+                               1583EA4D108395BB00A3BC0C /* NetworkConfiguration.plist in Resources */,
+                               1583EA4E108395BB00A3BC0C /* get-mobility-info in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               157A85180D56C8E000B6F1A0 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               1583EADA108395BB00A3BC0C /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        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;
+               1583EAE9108395BC00A3BC0C /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               157A85290D56C91100B6F1A0 /* linkconfig.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               157A85330D56C94F00B6F1A0 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               1583EB01108395BC00A3BC0C /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               157A85340D56C94F00B6F1A0 /* NetworkIdentification.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               157A853E0D56C96F00B6F1A0 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               1583EB10108395BC00A3BC0C /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               157A853F0D56C96F00B6F1A0 /* prefsmon.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               1583172C0CFB80A1006F62B9 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               1583EB1D108395BC00A3BC0C /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        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;
+               1583EB2C108395BD00A3BC0C /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               1583379E0CFB6B9E0033AB93 /* SCHelper_server.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159C9B2C0DB68E2600BEEF10 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               1583EB3B108395BD00A3BC0C /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159C9B290DB68E0700BEEF10 /* atconfig.c in Sources */,
-                               159C9B2A0DB68E0800BEEF10 /* cfManager.c in Sources */,
-                               159C9B2D0DB68E3D00BEEF10 /* cache.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159C9B840DB68F0300BEEF10 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               15A5A2180D5B94190087BDA0 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159C9B820DB68EE500BEEF10 /* kicker.c in Sources */,
+                               15A5A2190D5B94190087BDA0 /* Localizable.strings in Resources */,
+                               15A5A21A0D5B94190087BDA0 /* NetworkInterface.strings in Resources */,
+                               15A5A21B0D5B94190087BDA0 /* NetworkConfiguration.plist in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53D107528BDA004F8947 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               15DAD66807591A1A0084A6ED /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               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 */,
+                               15A6F7C40A4B266D00B907EA /* Localizable.strings in Resources */,
+                               15DAD66B07591A1A0084A6ED /* NetworkInterface.strings in Resources */,
+                               15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */,
+                               15DAD66A07591A1A0084A6ED /* get-mobility-info in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53E207528C4A004F8947 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               15FD72940754DA2B001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159D541607528DF1004F8947 /* ifnamer.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53E907528C61004F8947 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               15FD72A20754DA4C001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159D541707528E05004F8947 /* ip_plugin.c in Sources */,
-                               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;
                };
-               159D53F007528C79004F8947 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               15FD72B20754DA69001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159D541B07528E4A004F8947 /* linkconfig.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53F707528C95004F8947 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               15FD72C60754DA7E001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159D541C07528E58004F8947 /* prefsmon.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D54AB07529FFF004F8947 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               F95B8A6B0B03F9D100993BA3 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159D54AC07529FFF004F8947 /* configd.m in Sources */,
-                               159D54AD07529FFF004F8947 /* _SCD.c in Sources */,
-                               159D54AE07529FFF004F8947 /* configd_server.c in Sources */,
-                               159D54AF07529FFF004F8947 /* notify_server.c in Sources */,
-                               159D54B007529FFF004F8947 /* plugin_support.c in Sources */,
-                               159D54B107529FFF004F8947 /* session.c in Sources */,
-                               159D54B207529FFF004F8947 /* pattern.c in Sources */,
-                               159D54B307529FFF004F8947 /* _configopen.c in Sources */,
-                               159D54B407529FFF004F8947 /* _configclose.c in Sources */,
-                               159D54B507529FFF004F8947 /* _configlock.c in Sources */,
-                               159D54B607529FFF004F8947 /* _configunlock.c in Sources */,
-                               159D54B707529FFF004F8947 /* _configlist.c in Sources */,
-                               159D54B807529FFF004F8947 /* _configadd.c in Sources */,
-                               159D54B907529FFF004F8947 /* _configget.c in Sources */,
-                               159D54BA07529FFF004F8947 /* _configset.c in Sources */,
-                               159D54BB07529FFF004F8947 /* _configremove.c in Sources */,
-                               159D54BC07529FFF004F8947 /* _configtouch.c in Sources */,
-                               159D54BD07529FFF004F8947 /* _confignotify.c in Sources */,
-                               159D54BE07529FFF004F8947 /* _notifyadd.c in Sources */,
-                               159D54BF07529FFF004F8947 /* _notifyremove.c in Sources */,
-                               159D54C007529FFF004F8947 /* _notifychanges.c in Sources */,
-                               159D54C107529FFF004F8947 /* _notifyviaport.c in Sources */,
-                               159D54C207529FFF004F8947 /* _notifyviafd.c in Sources */,
-                               159D54C307529FFF004F8947 /* _notifyviasignal.c in Sources */,
-                               159D54C407529FFF004F8947 /* _notifycancel.c in Sources */,
-                               159D54C507529FFF004F8947 /* _snapshot.c in Sources */,
-                               159D54C607529FFF004F8947 /* config.defs in Sources */,
-                               159D54C707529FFF004F8947 /* dnsinfo_private.c in Sources */,
-                               159D54C807529FFF004F8947 /* dnsinfo_server.c in Sources */,
-                               159D54C907529FFF004F8947 /* shared_dns_info.defs in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15A5A21D0D5B94190087BDA0 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+               151F63DB09328A3C0096DCC9 /* ShellScript */ = {
+                       isa = PBXShellScriptBuildPhase;
                        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 */,
+                       );
+                       inputPaths = (
+                               SystemConfiguration.fproj/genSCPreferences.c,
+                       );
+                       outputPaths = (
+                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.h",
+                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitionsPrivate.h",
+                               "${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.c",
                        );
                        runOnlyForDeploymentPostprocessing = 0;
+                       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";
                };
-               15DAD5E4075913CE0084A6ED /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               153393E40D34999D00FE74E7 /* Update Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */,
-                               15DAD5E6075913CE0084A6ED /* dnsinfo_copy.c in Sources */,
-                               15DAD5E7075913CE0084A6ED /* dnsinfo_private.c in Sources */,
+                       );
+                       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";
                };
-               15DAD66C07591A1A0084A6ED /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               1572C5270CFB55B400E2776E /* get-mobility-info */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 8;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "get-mobility-info";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+                       shellPath = /bin/sh;
+                       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;
+               };
+               1583EA49108395BB00A3BC0C /* Update Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               15060818075A00A300B147BA /* SCSchemaDefinitions.c in Sources */,
-                               15DAD66D07591A1A0084A6ED /* SCD.c in Sources */,
-                               15DAD66E07591A1A0084A6ED /* SCDKeys.c in Sources */,
-                               15DAD66F07591A1A0084A6ED /* SCDPrivate.c in Sources */,
-                               15DAD67007591A1A0084A6ED /* SCDPlugin.c in Sources */,
-                               15DAD67107591A1A0084A6ED /* SCDOpen.c in Sources */,
-                               15DAD67207591A1A0084A6ED /* SCDLock.c in Sources */,
-                               15DAD67307591A1A0084A6ED /* SCDUnlock.c in Sources */,
-                               15DAD67407591A1A0084A6ED /* SCDList.c in Sources */,
-                               15DAD67507591A1A0084A6ED /* SCDAdd.c in Sources */,
-                               15DAD67607591A1A0084A6ED /* SCDGet.c in Sources */,
-                               15DAD67707591A1A0084A6ED /* SCDSet.c in Sources */,
-                               15DAD67807591A1A0084A6ED /* SCDRemove.c in Sources */,
-                               15DAD67907591A1A0084A6ED /* SCDTouch.c in Sources */,
-                               15DAD67A07591A1A0084A6ED /* SCDNotify.c in Sources */,
-                               15DAD67B07591A1A0084A6ED /* SCDNotifierSetKeys.c in Sources */,
-                               15DAD67C07591A1A0084A6ED /* SCDNotifierAdd.c in Sources */,
-                               15DAD67D07591A1A0084A6ED /* SCDNotifierRemove.c in Sources */,
-                               15DAD67E07591A1A0084A6ED /* SCDNotifierGetChanges.c in Sources */,
-                               15DAD67F07591A1A0084A6ED /* SCDNotifierWait.c in Sources */,
-                               15DAD68007591A1A0084A6ED /* SCDNotifierInformViaCallback.c in Sources */,
-                               15DAD68107591A1A0084A6ED /* SCDNotifierInformViaMachPort.c in Sources */,
-                               15DAD68207591A1A0084A6ED /* SCDNotifierInformViaFD.c in Sources */,
-                               15DAD68307591A1A0084A6ED /* SCDNotifierInformViaSignal.c in Sources */,
-                               15DAD68407591A1A0084A6ED /* SCDNotifierCancel.c in Sources */,
-                               15DAD68507591A1A0084A6ED /* SCDSnapshot.c in Sources */,
-                               15DAD68607591A1A0084A6ED /* SCP.c in Sources */,
-                               15DAD68707591A1A0084A6ED /* SCPOpen.c in Sources */,
-                               15DAD68807591A1A0084A6ED /* SCPLock.c in Sources */,
-                               15DAD68907591A1A0084A6ED /* SCPUnlock.c in Sources */,
-                               15DAD68A07591A1A0084A6ED /* SCPList.c in Sources */,
-                               15DAD68B07591A1A0084A6ED /* SCPGet.c in Sources */,
-                               15DAD68C07591A1A0084A6ED /* SCPAdd.c in Sources */,
-                               15DAD68D07591A1A0084A6ED /* SCPSet.c in Sources */,
-                               15DAD68E07591A1A0084A6ED /* SCPRemove.c in Sources */,
-                               15DAD68F07591A1A0084A6ED /* SCPCommit.c in Sources */,
-                               15DAD69007591A1A0084A6ED /* SCPApply.c in Sources */,
-                               15DAD69107591A1A0084A6ED /* SCPPath.c in Sources */,
-                               15DAD69207591A1A0084A6ED /* SCDConsoleUser.c in Sources */,
-                               15DAD69307591A1A0084A6ED /* SCDHostName.c in Sources */,
-                               15DAD69407591A1A0084A6ED /* SCLocation.c in Sources */,
-                               15DAD69507591A1A0084A6ED /* SCNetwork.c in Sources */,
-                               15DAD69607591A1A0084A6ED /* pppcontroller.defs in Sources */,
-                               15DAD69707591A1A0084A6ED /* SCNetworkConnection.c in Sources */,
-                               15A2972F0A13C08C009879B3 /* SCNetworkConnectionPrivate.c in Sources */,
-                               15DAD69807591A1A0084A6ED /* SCNetworkReachability.c in Sources */,
-                               15DAD69907591A1A0084A6ED /* SCProxies.c in Sources */,
-                               15DAD69A07591A1A0084A6ED /* DHCP.c in Sources */,
-                               15DAD69B07591A1A0084A6ED /* moh.c in Sources */,
-                               15DAD69C07591A1A0084A6ED /* DeviceOnHold.c in Sources */,
-                               15DAD69D07591A1A0084A6ED /* LinkConfiguration.c in Sources */,
-                               15DAD69E07591A1A0084A6ED /* dy_framework.c in Sources */,
-                               15DAD69F07591A1A0084A6ED /* VLANConfiguration.c in Sources */,
-                               15DAD6A007591A1A0084A6ED /* config.defs in Sources */,
-                               15DAD6A207591A1A0084A6ED /* SCPreferencesPathKey.c in Sources */,
-                               15DAD6A307591A1A0084A6ED /* dnsinfo_private.c in Sources */,
-                               15DAD6A407591A1A0084A6ED /* dnsinfo_copy.c in Sources */,
-                               15DAD6A507591A1A0084A6ED /* shared_dns_info.defs in Sources */,
-                               15DAD6A607591A1A0084A6ED /* SCNetworkConfigurationInternal.c in Sources */,
-                               15DAD6A707591A1A0084A6ED /* SCNetworkInterface.c in Sources */,
-                               15DAD6A807591A1A0084A6ED /* SCNetworkProtocol.c in Sources */,
-                               15DAD6A907591A1A0084A6ED /* SCNetworkService.c in Sources */,
-                               15DAD6AA07591A1A0084A6ED /* SCNetworkSet.c in Sources */,
-                               15DAD6AB07591A1A0084A6ED /* BondConfiguration.c in Sources */,
-                               15DAF2DA08466D4900D1B2BD /* helper_comm.c in Sources */,
-                               15DAF2DC08466D4900D1B2BD /* SCHelper_client.c in Sources */,
-                               152E68C30A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c in Sources */,
-                               F95B8A430B03E07A00993BA3 /* SCNetworkSignature.c in Sources */,
+                       );
+                       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";
                };
-               F95B8A5C0B03F81400993BA3 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
+               1583EA95108395BB00A3BC0C /* get-mobility-info */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 8;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "get-mobility-info";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+                       shellPath = /bin/sh;
+                       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 = (
-                               F95B8A690B03F9B500993BA3 /* NetworkIdentification.c in Sources */,
+                       );
+                       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;
                };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXTargetDependency section */
-               150ECB300D0042DA0065E94D /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 151F5D990CCE98E50093AC3B /* SCMonitor */;
-                       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 */;
-               };
-               1521405B0E9400BF00DACD2C /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15213FF90E93E9F500DACD2C /* Logger.bundle */;
-                       targetProxy = 1521405A0E9400BF00DACD2C /* PBXContainerItemProxy */;
-               };
-               1558480607550D470046C2E9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 159D549F07529FFF004F8947 /* configd */;
-                       targetProxy = 1558480507550D470046C2E9 /* PBXContainerItemProxy */;
-               };
-               1558480807550D470046C2E9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 1558481207550EC10046C2E9 /* scselect */;
-                       targetProxy = 1558480707550D470046C2E9 /* PBXContainerItemProxy */;
+               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;
                };
-               1558480A07550D470046C2E9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 155847430754FDCD0046C2E9 /* scutil */;
-                       targetProxy = 1558480907550D470046C2E9 /* PBXContainerItemProxy */;
+               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;
                };
-               1558480F07550DD00046C2E9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 155847FA07550D210046C2E9 /* configd_executables */;
-                       targetProxy = 1558480E07550DD00046C2E9 /* PBXContainerItemProxy */;
+               15DAD6B007591A1A0084A6ED /* get-mobility-info */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 8;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "get-mobility-info";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+                       shellPath = /bin/sh;
+                       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;
                };
-               156CA4A80EF8550800C59A18 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 156CA4790EF853BB00C59A18 /* Logger.bundle-Embedded */;
-                       targetProxy = 156CA4A70EF8550800C59A18 /* PBXContainerItemProxy */;
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+               151F5D970CCE98E50093AC3B /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15FC130B0CCEA59E0013872C /* monitor.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
                };
-               1574341F0D4A815E002ACA73 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 157433F00D4A8137002ACA73 /* scutil-Embedded */;
-                       targetProxy = 1574341E0D4A815E002ACA73 /* PBXContainerItemProxy */;
+               15213FF70E93E9F500DACD2C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               152140020E93EC6500DACD2C /* logger.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
                };
-               157434210D4A8166002ACA73 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 157433DD0D4A8122002ACA73 /* scselect-Embedded */;
-                       targetProxy = 157434200D4A8166002ACA73 /* PBXContainerItemProxy */;
+               1547001A08455B98006787CE /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15DAF2E108466D4900D1B2BD /* SCHelper_server.c in Sources */,
+                               152E0E7F10FE820E00E402F2 /* helper.defs in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
                };
-               157A85480D56CA0B00B6F1A0 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 157A84F40D56C7E800B6F1A0 /* IPMonitor-Embedded */;
-                       targetProxy = 157A85470D56CA0B00B6F1A0 /* PBXContainerItemProxy */;
+               155847540754FDCD0046C2E9 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               155847550754FDCD0046C2E9 /* scutil.c in Sources */,
+                               155847560754FDCD0046C2E9 /* commands.c in Sources */,
+                               155847570754FDCD0046C2E9 /* dictionary.c in Sources */,
+                               155847580754FDCD0046C2E9 /* session.c in Sources */,
+                               155847590754FDCD0046C2E9 /* cache.c in Sources */,
+                               1558475A0754FDCD0046C2E9 /* notifications.c in Sources */,
+                               1558475B0754FDCD0046C2E9 /* tests.c in Sources */,
+                               1558475C0754FDCD0046C2E9 /* prefs.c in Sources */,
+                               1558475D0754FDCD0046C2E9 /* net.c in Sources */,
+                               1558475E0754FDCD0046C2E9 /* net_interface.c in Sources */,
+                               1558475F0754FDCD0046C2E9 /* net_protocol.c in Sources */,
+                               155847600754FDCD0046C2E9 /* net_service.c in Sources */,
+                               155847610754FDCD0046C2E9 /* net_set.c in Sources */,
+                               72B43729113C7BFC00EBF1B6 /* nc.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
                };
-               157A854A0D56CA2300B6F1A0 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 157A85050D56C8AA00B6F1A0 /* InterfaceNamer-Embedded */;
-                       targetProxy = 157A85490D56CA2300B6F1A0 /* PBXContainerItemProxy */;
+               1558481507550EC10046C2E9 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1558481607550EC10046C2E9 /* scselect.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
                };
-               157A854C0D56CA5100B6F1A0 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 157A85100D56C8E000B6F1A0 /* KernelEventMonitor-Embedded */;
-                       targetProxy = 157A854B0D56CA5100B6F1A0 /* PBXContainerItemProxy */;
+               156CA47A0EF853BB00C59A18 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               156CA47B0EF853BB00C59A18 /* logger.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
                };
-               157A854E0D56CA6F00B6F1A0 /* PBXTargetDependency */ = {
+               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 */,
+                               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 */,
+                               1572C5200CFB55B400E2776E /* SCHelper_client.c in Sources */,
+                               1572C5210CFB55B400E2776E /* SCPreferencesKeychainPrivate.c in Sources */,
+                               1572C5220CFB55B400E2776E /* SCNetworkSignature.c in Sources */,
+                               15A1FF3310597F17004C9CC9 /* CaptiveNetwork.c in Sources */,
+                               159A751E107FEAA400A57EAB /* VPNPrivate.c in Sources */,
+                               159A7520107FEAA400A57EAB /* VPNConfiguration.c in Sources */,
+                               15AAA7F6108E310700C2A607 /* VPNTunnel.c in Sources */,
+                               158E595F1107CAE80062081E /* helper.defs in Sources */,
+                               152691D81129EE8A006BD2D5 /* BondConfiguration.c in Sources */,
+                               152691DB1129EEA6006BD2D5 /* BridgeConfiguration.c in Sources */,
+                               152691DE1129EEC2006BD2D5 /* VLANConfiguration.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 */,
+                               72B4372B113C7BFC00EBF1B6 /* nc.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 */,
+                               1575FD2712CD15C60003D86E /* proxy-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 */,
+                               152E0E8010FE820E00E402F2 /* helper.defs in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EA08108395BB00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EA09108395BB00A3BC0C /* shared_dns_info.defs in Sources */,
+                               1583EA0A108395BB00A3BC0C /* dnsinfo_copy.c in Sources */,
+                               1583EA0B108395BB00A3BC0C /* dnsinfo_private.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EA4F108395BB00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EA50108395BB00A3BC0C /* SCSchemaDefinitions.c in Sources */,
+                               1583EA51108395BB00A3BC0C /* SCD.c in Sources */,
+                               1583EA52108395BB00A3BC0C /* SCDKeys.c in Sources */,
+                               1583EA53108395BB00A3BC0C /* SCDPrivate.c in Sources */,
+                               1583EA54108395BB00A3BC0C /* SCDPlugin.c in Sources */,
+                               1583EA55108395BB00A3BC0C /* SCDOpen.c in Sources */,
+                               1583EA56108395BB00A3BC0C /* SCDLock.c in Sources */,
+                               1583EA57108395BB00A3BC0C /* SCDUnlock.c in Sources */,
+                               1583EA58108395BB00A3BC0C /* SCDList.c in Sources */,
+                               1583EA59108395BB00A3BC0C /* SCDAdd.c in Sources */,
+                               1583EA5A108395BB00A3BC0C /* SCDGet.c in Sources */,
+                               1583EA5B108395BB00A3BC0C /* SCDSet.c in Sources */,
+                               1583EA5C108395BB00A3BC0C /* SCDRemove.c in Sources */,
+                               1583EA5D108395BB00A3BC0C /* SCDTouch.c in Sources */,
+                               1583EA5E108395BB00A3BC0C /* SCDNotify.c in Sources */,
+                               1583EA5F108395BB00A3BC0C /* SCDNotifierSetKeys.c in Sources */,
+                               1583EA60108395BB00A3BC0C /* SCDNotifierAdd.c in Sources */,
+                               1583EA61108395BB00A3BC0C /* SCDNotifierRemove.c in Sources */,
+                               1583EA62108395BB00A3BC0C /* SCDNotifierGetChanges.c in Sources */,
+                               1583EA63108395BB00A3BC0C /* SCDNotifierWait.c in Sources */,
+                               1583EA64108395BB00A3BC0C /* SCDNotifierInformViaCallback.c in Sources */,
+                               1583EA65108395BB00A3BC0C /* SCDNotifierInformViaMachPort.c in Sources */,
+                               1583EA66108395BB00A3BC0C /* SCDNotifierInformViaFD.c in Sources */,
+                               1583EA67108395BB00A3BC0C /* SCDNotifierInformViaSignal.c in Sources */,
+                               1583EA68108395BB00A3BC0C /* SCDNotifierCancel.c in Sources */,
+                               1583EA69108395BB00A3BC0C /* SCDSnapshot.c in Sources */,
+                               1583EA6A108395BB00A3BC0C /* SCP.c in Sources */,
+                               1583EA6B108395BB00A3BC0C /* SCPOpen.c in Sources */,
+                               1583EA6C108395BB00A3BC0C /* SCPLock.c in Sources */,
+                               1583EA6D108395BB00A3BC0C /* SCPUnlock.c in Sources */,
+                               1583EA6E108395BB00A3BC0C /* SCPList.c in Sources */,
+                               1583EA6F108395BB00A3BC0C /* SCPGet.c in Sources */,
+                               1583EA70108395BB00A3BC0C /* SCPAdd.c in Sources */,
+                               1583EA71108395BB00A3BC0C /* SCPSet.c in Sources */,
+                               1583EA72108395BB00A3BC0C /* SCPRemove.c in Sources */,
+                               1583EA73108395BB00A3BC0C /* SCPCommit.c in Sources */,
+                               1583EA74108395BB00A3BC0C /* SCPApply.c in Sources */,
+                               1583EA75108395BB00A3BC0C /* SCPPath.c in Sources */,
+                               1583EA76108395BB00A3BC0C /* SCDHostName.c in Sources */,
+                               1583EA77108395BB00A3BC0C /* SCLocation.c in Sources */,
+                               1583EA78108395BB00A3BC0C /* SCNetwork.c in Sources */,
+                               1583EA79108395BB00A3BC0C /* pppcontroller.defs in Sources */,
+                               1583EA7A108395BB00A3BC0C /* SCNetworkConnection.c in Sources */,
+                               1583EA7B108395BB00A3BC0C /* SCNetworkConnectionPrivate.c in Sources */,
+                               1583EA7C108395BB00A3BC0C /* SCNetworkReachability.c in Sources */,
+                               1583EA7D108395BB00A3BC0C /* SCProxies.c in Sources */,
+                               1583EA7E108395BB00A3BC0C /* DHCP.c in Sources */,
+                               1583EA7F108395BB00A3BC0C /* moh.c in Sources */,
+                               1583EA80108395BB00A3BC0C /* DeviceOnHold.c in Sources */,
+                               1583EA81108395BB00A3BC0C /* LinkConfiguration.c in Sources */,
+                               1583EA82108395BB00A3BC0C /* dy_framework.c in Sources */,
+                               1583EA83108395BB00A3BC0C /* config.defs in Sources */,
+                               1583EA84108395BB00A3BC0C /* SCPreferencesPathKey.c in Sources */,
+                               1583EA85108395BB00A3BC0C /* shared_dns_info.defs in Sources */,
+                               1583EA86108395BB00A3BC0C /* SCNetworkConfigurationInternal.c in Sources */,
+                               1583EA87108395BB00A3BC0C /* SCNetworkInterface.c in Sources */,
+                               1583EA88108395BB00A3BC0C /* SCNetworkProtocol.c in Sources */,
+                               1583EA89108395BB00A3BC0C /* SCNetworkService.c in Sources */,
+                               1583EA8A108395BB00A3BC0C /* SCNetworkSet.c in Sources */,
+                               1583EA8C108395BB00A3BC0C /* SCHelper_client.c in Sources */,
+                               1583EA8D108395BB00A3BC0C /* SCPreferencesKeychainPrivate.c in Sources */,
+                               1583EA8E108395BB00A3BC0C /* SCNetworkSignature.c in Sources */,
+                               1583EA8F108395BB00A3BC0C /* CaptiveNetwork.c in Sources */,
+                               158E59601107CAF10062081E /* helper.defs in Sources */,
+                               152691D91129EE94006BD2D5 /* BondConfiguration.c in Sources */,
+                               152691DD1129EEB1006BD2D5 /* BridgeConfiguration.c in Sources */,
+                               152691E01129EECB006BD2D5 /* VLANConfiguration.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EA9F108395BB00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EAA0108395BB00A3BC0C /* SCHelper_server.c in Sources */,
+                               152E0E8110FE820E00E402F2 /* helper.defs in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EACF108395BB00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EAD0108395BB00A3BC0C /* ip_plugin.c in Sources */,
+                               1583EAD1108395BB00A3BC0C /* dns-configuration.c in Sources */,
+                               1575FD2B12CD15C60003D86E /* proxy-configuration.c in Sources */,
+                               1583EAD2108395BB00A3BC0C /* set-hostname.c in Sources */,
+                               1583EAD3108395BB00A3BC0C /* dnsinfo_create.c in Sources */,
+                               1583EAD4108395BB00A3BC0C /* shared_dns_info.defs in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EAE2108395BB00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EAE3108395BB00A3BC0C /* ifnamer.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EAF6108395BC00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EAF7108395BC00A3BC0C /* cache.c in Sources */,
+                               1583EAF8108395BC00A3BC0C /* ev_dlil.c in Sources */,
+                               1583EAF9108395BC00A3BC0C /* ev_ipv4.c in Sources */,
+                               1583EAFA108395BC00A3BC0C /* ev_ipv6.c in Sources */,
+                               1583EAFB108395BC00A3BC0C /* eventmon.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB09108395BC00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EB0A108395BC00A3BC0C /* linkconfig.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB17108395BC00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EB18108395BC00A3BC0C /* logger.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB25108395BD00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EB26108395BD00A3BC0C /* NetworkIdentification.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB34108395BD00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EB35108395BD00A3BC0C /* prefsmon.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB54108395BD00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EB55108395BD00A3BC0C /* configd.m in Sources */,
+                               1583EB56108395BD00A3BC0C /* _SCD.c in Sources */,
+                               1583EB57108395BD00A3BC0C /* configd_server.c in Sources */,
+                               1583EB58108395BD00A3BC0C /* notify_server.c in Sources */,
+                               1583EB59108395BD00A3BC0C /* plugin_support.c in Sources */,
+                               1583EB5A108395BD00A3BC0C /* session.c in Sources */,
+                               1583EB5B108395BD00A3BC0C /* pattern.c in Sources */,
+                               1583EB5C108395BD00A3BC0C /* _configopen.c in Sources */,
+                               1583EB5D108395BD00A3BC0C /* _configclose.c in Sources */,
+                               1583EB5E108395BD00A3BC0C /* _configlock.c in Sources */,
+                               1583EB5F108395BD00A3BC0C /* _configunlock.c in Sources */,
+                               1583EB60108395BD00A3BC0C /* _configlist.c in Sources */,
+                               1583EB61108395BD00A3BC0C /* _configadd.c in Sources */,
+                               1583EB62108395BD00A3BC0C /* _configget.c in Sources */,
+                               1583EB63108395BD00A3BC0C /* _configset.c in Sources */,
+                               1583EB64108395BD00A3BC0C /* _configremove.c in Sources */,
+                               1583EB65108395BD00A3BC0C /* _configtouch.c in Sources */,
+                               1583EB66108395BD00A3BC0C /* _confignotify.c in Sources */,
+                               1583EB67108395BD00A3BC0C /* _notifyadd.c in Sources */,
+                               1583EB68108395BD00A3BC0C /* _notifyremove.c in Sources */,
+                               1583EB69108395BD00A3BC0C /* _notifychanges.c in Sources */,
+                               1583EB6A108395BD00A3BC0C /* _notifyviaport.c in Sources */,
+                               1583EB6B108395BD00A3BC0C /* _notifyviafd.c in Sources */,
+                               1583EB6C108395BD00A3BC0C /* _notifyviasignal.c in Sources */,
+                               1583EB6D108395BD00A3BC0C /* _notifycancel.c in Sources */,
+                               1583EB6E108395BD00A3BC0C /* _snapshot.c in Sources */,
+                               1583EB6F108395BD00A3BC0C /* config.defs in Sources */,
+                               1583EB70108395BD00A3BC0C /* dnsinfo_private.c in Sources */,
+                               1583EB71108395BD00A3BC0C /* dnsinfo_server.c in Sources */,
+                               1583EB72108395BD00A3BC0C /* shared_dns_info.defs in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EB88108395BE00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EB89108395BE00A3BC0C /* scselect.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583EBA1108395BE00A3BC0C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583EBA2108395BE00A3BC0C /* scutil.c in Sources */,
+                               1583EBA3108395BE00A3BC0C /* commands.c in Sources */,
+                               1583EBA4108395BE00A3BC0C /* dictionary.c in Sources */,
+                               1583EBA5108395BE00A3BC0C /* session.c in Sources */,
+                               1583EBA6108395BE00A3BC0C /* cache.c in Sources */,
+                               1583EBA7108395BE00A3BC0C /* notifications.c in Sources */,
+                               1583EBA8108395BE00A3BC0C /* tests.c in Sources */,
+                               1583EBA9108395BE00A3BC0C /* prefs.c in Sources */,
+                               1583EBAA108395BE00A3BC0C /* net.c in Sources */,
+                               1583EBAB108395BE00A3BC0C /* net_interface.c in Sources */,
+                               1583EBAC108395BE00A3BC0C /* net_protocol.c in Sources */,
+                               1583EBAD108395BE00A3BC0C /* net_service.c in Sources */,
+                               1583EBAE108395BE00A3BC0C /* net_set.c in Sources */,
+                               15B274A5114467CD003414AD /* nc.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53D107528BDA004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               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;
+               };
+               159D53E207528C4A004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D541607528DF1004F8947 /* ifnamer.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53E907528C61004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D541707528E05004F8947 /* ip_plugin.c in Sources */,
+                               159D541807528E09004F8947 /* dns-configuration.c in Sources */,
+                               1575FD2912CD15C60003D86E /* proxy-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;
+               };
+               159D53F007528C79004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D541B07528E4A004F8947 /* linkconfig.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D53F707528C95004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D541C07528E58004F8947 /* prefsmon.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159D54AB07529FFF004F8947 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D54AC07529FFF004F8947 /* configd.m in Sources */,
+                               159D54AD07529FFF004F8947 /* _SCD.c in Sources */,
+                               159D54AE07529FFF004F8947 /* configd_server.c in Sources */,
+                               159D54AF07529FFF004F8947 /* notify_server.c in Sources */,
+                               159D54B007529FFF004F8947 /* plugin_support.c in Sources */,
+                               159D54B107529FFF004F8947 /* session.c in Sources */,
+                               159D54B207529FFF004F8947 /* pattern.c in Sources */,
+                               159D54B307529FFF004F8947 /* _configopen.c in Sources */,
+                               159D54B407529FFF004F8947 /* _configclose.c in Sources */,
+                               159D54B507529FFF004F8947 /* _configlock.c in Sources */,
+                               159D54B607529FFF004F8947 /* _configunlock.c in Sources */,
+                               159D54B707529FFF004F8947 /* _configlist.c in Sources */,
+                               159D54B807529FFF004F8947 /* _configadd.c in Sources */,
+                               159D54B907529FFF004F8947 /* _configget.c in Sources */,
+                               159D54BA07529FFF004F8947 /* _configset.c in Sources */,
+                               159D54BB07529FFF004F8947 /* _configremove.c in Sources */,
+                               159D54BC07529FFF004F8947 /* _configtouch.c in Sources */,
+                               159D54BD07529FFF004F8947 /* _confignotify.c in Sources */,
+                               159D54BE07529FFF004F8947 /* _notifyadd.c in Sources */,
+                               159D54BF07529FFF004F8947 /* _notifyremove.c in Sources */,
+                               159D54C007529FFF004F8947 /* _notifychanges.c in Sources */,
+                               159D54C107529FFF004F8947 /* _notifyviaport.c in Sources */,
+                               159D54C207529FFF004F8947 /* _notifyviafd.c in Sources */,
+                               159D54C307529FFF004F8947 /* _notifyviasignal.c in Sources */,
+                               159D54C407529FFF004F8947 /* _notifycancel.c in Sources */,
+                               159D54C507529FFF004F8947 /* _snapshot.c in Sources */,
+                               159D54C607529FFF004F8947 /* config.defs in Sources */,
+                               159D54C707529FFF004F8947 /* dnsinfo_private.c in Sources */,
+                               159D54C807529FFF004F8947 /* dnsinfo_server.c in Sources */,
+                               159D54C907529FFF004F8947 /* shared_dns_info.defs in Sources */,
+                       );
+                       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 */,
+                               15A5A25F0D5B94190087BDA0 /* SCHelper_client.c in Sources */,
+                               15A5A2600D5B94190087BDA0 /* SCPreferencesKeychainPrivate.c in Sources */,
+                               15A5A2610D5B94190087BDA0 /* SCNetworkSignature.c in Sources */,
+                               15A1FF3510597F17004C9CC9 /* CaptiveNetwork.c in Sources */,
+                               159A752C107FEAA400A57EAB /* VPNPrivate.c in Sources */,
+                               159A752E107FEAA400A57EAB /* VPNConfiguration.c in Sources */,
+                               158E59611107CAF40062081E /* helper.defs in Sources */,
+                               152691DA1129EE98006BD2D5 /* BondConfiguration.c in Sources */,
+                               152691DC1129EEAD006BD2D5 /* BridgeConfiguration.c in Sources */,
+                               152691DF1129EEC8006BD2D5 /* VLANConfiguration.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD5E4075913CE0084A6ED /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */,
+                               15DAD5E6075913CE0084A6ED /* dnsinfo_copy.c in Sources */,
+                               15DAD5E7075913CE0084A6ED /* dnsinfo_private.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15DAD66C07591A1A0084A6ED /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15060818075A00A300B147BA /* SCSchemaDefinitions.c in Sources */,
+                               15DAD66D07591A1A0084A6ED /* SCD.c in Sources */,
+                               15DAD66E07591A1A0084A6ED /* SCDKeys.c in Sources */,
+                               15DAD66F07591A1A0084A6ED /* SCDPrivate.c in Sources */,
+                               15DAD67007591A1A0084A6ED /* SCDPlugin.c in Sources */,
+                               15DAD67107591A1A0084A6ED /* SCDOpen.c in Sources */,
+                               15DAD67207591A1A0084A6ED /* SCDLock.c in Sources */,
+                               15DAD67307591A1A0084A6ED /* SCDUnlock.c in Sources */,
+                               15DAD67407591A1A0084A6ED /* SCDList.c in Sources */,
+                               15DAD67507591A1A0084A6ED /* SCDAdd.c in Sources */,
+                               15DAD67607591A1A0084A6ED /* SCDGet.c in Sources */,
+                               15DAD67707591A1A0084A6ED /* SCDSet.c in Sources */,
+                               15DAD67807591A1A0084A6ED /* SCDRemove.c in Sources */,
+                               15DAD67907591A1A0084A6ED /* SCDTouch.c in Sources */,
+                               15DAD67A07591A1A0084A6ED /* SCDNotify.c in Sources */,
+                               15DAD67B07591A1A0084A6ED /* SCDNotifierSetKeys.c in Sources */,
+                               15DAD67C07591A1A0084A6ED /* SCDNotifierAdd.c in Sources */,
+                               15DAD67D07591A1A0084A6ED /* SCDNotifierRemove.c in Sources */,
+                               15DAD67E07591A1A0084A6ED /* SCDNotifierGetChanges.c in Sources */,
+                               15DAD67F07591A1A0084A6ED /* SCDNotifierWait.c in Sources */,
+                               15DAD68007591A1A0084A6ED /* SCDNotifierInformViaCallback.c in Sources */,
+                               15DAD68107591A1A0084A6ED /* SCDNotifierInformViaMachPort.c in Sources */,
+                               15DAD68207591A1A0084A6ED /* SCDNotifierInformViaFD.c in Sources */,
+                               15DAD68307591A1A0084A6ED /* SCDNotifierInformViaSignal.c in Sources */,
+                               15DAD68407591A1A0084A6ED /* SCDNotifierCancel.c in Sources */,
+                               15DAD68507591A1A0084A6ED /* SCDSnapshot.c in Sources */,
+                               15DAD68607591A1A0084A6ED /* SCP.c in Sources */,
+                               15DAD68707591A1A0084A6ED /* SCPOpen.c in Sources */,
+                               15DAD68807591A1A0084A6ED /* SCPLock.c in Sources */,
+                               15DAD68907591A1A0084A6ED /* SCPUnlock.c in Sources */,
+                               15DAD68A07591A1A0084A6ED /* SCPList.c in Sources */,
+                               15DAD68B07591A1A0084A6ED /* SCPGet.c in Sources */,
+                               15DAD68C07591A1A0084A6ED /* SCPAdd.c in Sources */,
+                               15DAD68D07591A1A0084A6ED /* SCPSet.c in Sources */,
+                               15DAD68E07591A1A0084A6ED /* SCPRemove.c in Sources */,
+                               15DAD68F07591A1A0084A6ED /* SCPCommit.c in Sources */,
+                               15DAD69007591A1A0084A6ED /* SCPApply.c in Sources */,
+                               15DAD69107591A1A0084A6ED /* SCPPath.c in Sources */,
+                               15DAD69207591A1A0084A6ED /* SCDConsoleUser.c in Sources */,
+                               15DAD69307591A1A0084A6ED /* SCDHostName.c in Sources */,
+                               15DAD69407591A1A0084A6ED /* SCLocation.c in Sources */,
+                               15DAD69507591A1A0084A6ED /* SCNetwork.c in Sources */,
+                               15DAD69607591A1A0084A6ED /* pppcontroller.defs in Sources */,
+                               15DAD69707591A1A0084A6ED /* SCNetworkConnection.c in Sources */,
+                               15A2972F0A13C08C009879B3 /* SCNetworkConnectionPrivate.c in Sources */,
+                               15DAD69807591A1A0084A6ED /* SCNetworkReachability.c in Sources */,
+                               15DAD69907591A1A0084A6ED /* SCProxies.c in Sources */,
+                               15DAD69A07591A1A0084A6ED /* DHCP.c in Sources */,
+                               15DAD69B07591A1A0084A6ED /* moh.c in Sources */,
+                               15DAD69C07591A1A0084A6ED /* DeviceOnHold.c in Sources */,
+                               15DAD69D07591A1A0084A6ED /* LinkConfiguration.c in Sources */,
+                               15DAD69E07591A1A0084A6ED /* dy_framework.c in Sources */,
+                               15DAD69F07591A1A0084A6ED /* VLANConfiguration.c in Sources */,
+                               15DAD6A007591A1A0084A6ED /* config.defs in Sources */,
+                               15DAD6A207591A1A0084A6ED /* SCPreferencesPathKey.c in Sources */,
+                               15DAD6A507591A1A0084A6ED /* shared_dns_info.defs in Sources */,
+                               15DAD6A607591A1A0084A6ED /* SCNetworkConfigurationInternal.c in Sources */,
+                               15DAD6A707591A1A0084A6ED /* SCNetworkInterface.c in Sources */,
+                               15DAD6A807591A1A0084A6ED /* SCNetworkProtocol.c in Sources */,
+                               15DAD6A907591A1A0084A6ED /* SCNetworkService.c in Sources */,
+                               15DAD6AA07591A1A0084A6ED /* SCNetworkSet.c in Sources */,
+                               15DAD6AB07591A1A0084A6ED /* BondConfiguration.c in Sources */,
+                               15FD7B3C101E439200C56621 /* BridgeConfiguration.c in Sources */,
+                               15DAF2DC08466D4900D1B2BD /* SCHelper_client.c in Sources */,
+                               152E68C30A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c in Sources */,
+                               F95B8A430B03E07A00993BA3 /* SCNetworkSignature.c in Sources */,
+                               159A7525107FEAA400A57EAB /* VPNPrivate.c in Sources */,
+                               159A7527107FEAA400A57EAB /* VPNConfiguration.c in Sources */,
+                               15AAA7F9108E310700C2A607 /* VPNTunnel.c in Sources */,
+                               158E595E1107CAE40062081E /* helper.defs in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               F95B8A5C0B03F81400993BA3 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               F95B8A690B03F9B500993BA3 /* NetworkIdentification.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+               150ECB300D0042DA0065E94D /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 151F5D990CCE98E50093AC3B /* SCMonitor */;
+                       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 */;
+               };
+               1521405B0E9400BF00DACD2C /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15213FF90E93E9F500DACD2C /* Logger.bundle */;
+                       targetProxy = 1521405A0E9400BF00DACD2C /* PBXContainerItemProxy */;
+               };
+               1558480607550D470046C2E9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D549F07529FFF004F8947 /* configd */;
+                       targetProxy = 1558480507550D470046C2E9 /* PBXContainerItemProxy */;
+               };
+               1558480807550D470046C2E9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1558481207550EC10046C2E9 /* scselect */;
+                       targetProxy = 1558480707550D470046C2E9 /* PBXContainerItemProxy */;
+               };
+               1558480A07550D470046C2E9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 155847430754FDCD0046C2E9 /* scutil */;
+                       targetProxy = 1558480907550D470046C2E9 /* PBXContainerItemProxy */;
+               };
+               1558480F07550DD00046C2E9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 155847FA07550D210046C2E9 /* configd_executables */;
+                       targetProxy = 1558480E07550DD00046C2E9 /* PBXContainerItemProxy */;
+               };
+               156CA4A80EF8550800C59A18 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 156CA4790EF853BB00C59A18 /* Logger.bundle-Embedded */;
+                       targetProxy = 156CA4A70EF8550800C59A18 /* PBXContainerItemProxy */;
+               };
+               1574341F0D4A815E002ACA73 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       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 */;
+               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;
+                       target = 157BB8AE075924360025DA7A /* configd_base */;
+                       targetProxy = 157BB8C30759244B0025DA7A /* PBXContainerItemProxy */;
+               };
+               15828B070753B77E00AD4710 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       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 */;
+                       targetProxy = 158AD9850754E72500124717 /* PBXContainerItemProxy */;
+               };
+               158AD9880754E72500124717 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */;
+                       targetProxy = 158AD9870754E72500124717 /* PBXContainerItemProxy */;
+               };
+               158AD98C0754E72500124717 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15FD72B10754DA69001CC321 /* LinkConfiguration.bundle */;
+                       targetProxy = 158AD98B0754E72500124717 /* PBXContainerItemProxy */;
+               };
+               158AD98E0754E72500124717 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15FD72C50754DA7E001CC321 /* PreferencesMonitor.bundle */;
+                       targetProxy = 158AD98D0754E72500124717 /* PBXContainerItemProxy */;
+               };
+               159D542207528E85004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D53D307528BDA004F8947 /* KernelEventMonitor */;
+                       targetProxy = 159D542107528E85004F8947 /* PBXContainerItemProxy */;
+               };
+               159D542607528E85004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D53E407528C4A004F8947 /* InterfaceNamer */;
+                       targetProxy = 159D542507528E85004F8947 /* PBXContainerItemProxy */;
+               };
+               159D542807528E85004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D53EB07528C61004F8947 /* IPMonitor */;
+                       targetProxy = 159D542707528E85004F8947 /* PBXContainerItemProxy */;
+               };
+               159D542A07528E85004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D53F207528C79004F8947 /* LinkConfiguration */;
+                       targetProxy = 159D542907528E85004F8947 /* PBXContainerItemProxy */;
+               };
+               159D542C07528E85004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D53F907528C95004F8947 /* PreferencesMonitor */;
+                       targetProxy = 159D542B07528E85004F8947 /* PBXContainerItemProxy */;
+               };
+               159D542E07529008004F8947 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 159D542007528E7C004F8947 /* configd_plugins */;
+                       targetProxy = 159D542D07529008004F8947 /* PBXContainerItemProxy */;
+               };
+               15A5A2710D5B942D0087BDA0 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15A5A1E40D5B94190087BDA0 /* SystemConfiguration.framework-EmbeddedSimulator */;
+                       targetProxy = 15A5A2700D5B942D0087BDA0 /* PBXContainerItemProxy */;
+               };
+               15AC515810839608004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583E9FD108395BB00A3BC0C /* configd_libSystem-EmbeddedOther */;
+                       targetProxy = 15AC515710839608004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC515B1083960E004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EA11108395BB00A3BC0C /* configd_base-EmbeddedOther */;
+                       targetProxy = 15AC515A1083960E004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC515D10839613004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EAAC108395BB00A3BC0C /* configd_plugins-EmbeddedOther */;
+                       targetProxy = 15AC515C10839613004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC515F1083961E004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB41108395BD00A3BC0C /* configd_executables-EmbeddedOther */;
+                       targetProxy = 15AC515E1083961E004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC516110839649004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EA04108395BB00A3BC0C /* DNSConfiguration-EmbeddedOther */;
+                       targetProxy = 15AC516010839649004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC516310839666004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EA19108395BB00A3BC0C /* SystemConfiguration.framework-EmbeddedOther */;
+                       targetProxy = 15AC516210839666004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC51651083966B004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EA9B108395BB00A3BC0C /* SCHelper-EmbeddedOther */;
+                       targetProxy = 15AC51641083966B004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC516A108396B7004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB92108395BE00A3BC0C /* scutil-EmbeddedOther */;
+                       targetProxy = 15AC5169108396B7004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC516C108396B7004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB86108395BE00A3BC0C /* scselect-EmbeddedOther */;
+                       targetProxy = 15AC516B108396B7004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC516E108396B7004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB4B108395BD00A3BC0C /* configd-EmbeddedOther */;
+                       targetProxy = 15AC516D108396B7004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC5171108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB3A108395BD00A3BC0C /* PreferencesMonitor.bundle-EmbeddedOther */;
+                       targetProxy = 15AC5170108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC5173108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB32108395BD00A3BC0C /* PreferencesMonitor-EmbeddedOther */;
+                       targetProxy = 15AC5172108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC5175108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB2B108395BD00A3BC0C /* NetworkIdentification.bundle-EmbeddedOther */;
+                       targetProxy = 15AC5174108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC5177108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB23108395BD00A3BC0C /* NetworkIdentification-EmbeddedOther */;
+                       targetProxy = 15AC5176108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC5179108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB16108395BC00A3BC0C /* Logger.bundle-EmbeddedOther */;
+                       targetProxy = 15AC5178108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC517B108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB0F108395BC00A3BC0C /* LinkConfiguration.bundle-EmbeddedOther */;
+                       targetProxy = 15AC517A108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC517D108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB07108395BC00A3BC0C /* LinkConfiguration-EmbeddedOther */;
+                       targetProxy = 15AC517C108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC517F108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EB00108395BC00A3BC0C /* KernelEventMonitor.bundle-EmbeddedOther */;
+                       targetProxy = 15AC517E108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC5181108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EAEF108395BC00A3BC0C /* KernelEventMonitor-EmbeddedOther */;
+                       targetProxy = 15AC5180108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC5183108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EAE8108395BC00A3BC0C /* InterfaceNamer.bundle-EmbeddedOther */;
+                       targetProxy = 15AC5182108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC5185108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EAE0108395BB00A3BC0C /* InterfaceNamer-EmbeddedOther */;
+                       targetProxy = 15AC5184108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC5187108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EAD9108395BB00A3BC0C /* IPMonitor.bundle-EmbeddedOther */;
+                       targetProxy = 15AC5186108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15AC5189108396D2004A9ED5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583EACA108395BB00A3BC0C /* IPMonitor-EmbeddedOther */;
+                       targetProxy = 15AC5188108396D2004A9ED5 /* PBXContainerItemProxy */;
+               };
+               15C64A220F684C4900D78394 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15DAD5DF075913CE0084A6ED /* DNSConfiguration */;
+                       targetProxy = 15C64A210F684C4900D78394 /* PBXContainerItemProxy */;
+               };
+               15C64A240F684C5700D78394 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       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;
+                       target = F95B8A6A0B03F9D100993BA3 /* NetworkIdentification.bundle */;
+                       targetProxy = F95B8A760B03FB9100993BA3 /* PBXContainerItemProxy */;
+               };
+               F95B8A790B03FB9100993BA3 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = F95B8A5E0B03F81400993BA3 /* NetworkIdentification */;
+                       targetProxy = F95B8A780B03FB9100993BA3 /* PBXContainerItemProxy */;
+               };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+               1577253606EFBF3100D7B52B /* NetworkInterface.strings */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               1577252F06EFB96700D7B52B /* English */,
+                       );
+                       name = NetworkInterface.strings;
+                       sourceTree = "<group>";
+               };
+               15A6F7C20A4B266D00B907EA /* Localizable.strings */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               15A6F7C30A4B266D00B907EA /* English */,
+                       );
+                       name = Localizable.strings;
+                       sourceTree = "<group>";
+               };
+               15FEE8180CD03CBB001312F9 /* Localizable.strings */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               15FEE8160CD03CA3001312F9 /* English */,
+                       );
+                       name = Localizable.strings;
+                       sourceTree = "<group>";
+               };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+               151C1CC70CFB487000C5AFD6 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd (Aggregate/Embedded)";
+                       };
+                       name = Debug;
+               };
+               151C1CC80CFB487000C5AFD6 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd (Aggregate/Embedded)";
+                       };
+                       name = Release;
                };
-               157A85520D56CA9E00B6F1A0 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 157A853C0D56C96F00B6F1A0 /* PreferencesMonitor-Embedded */;
-                       targetProxy = 157A85510D56CA9E00B6F1A0 /* PBXContainerItemProxy */;
+               151F5D9C0CCE98E60093AC3B /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INFOPLIST_FILE = SCMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /System/Library/UserEventPlugins;
+                               PRODUCT_NAME = SCMonitor;
+                               WRAPPER_EXTENSION = plugin;
+                       };
+                       name = Debug;
                };
-               157A85540D56CACA00B6F1A0 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 158317A80CFB8639006F62B9 /* PreferencesMonitor.bundle-Embedded */;
-                       targetProxy = 157A85530D56CACA00B6F1A0 /* PBXContainerItemProxy */;
+               151F5D9D0CCE98E60093AC3B /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INFOPLIST_FILE = SCMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /System/Library/UserEventPlugins;
+                               PRODUCT_NAME = SCMonitor;
+                               WRAPPER_EXTENSION = plugin;
+                       };
+                       name = Release;
                };
-               157BB8C0075924460025DA7A /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */;
-                       targetProxy = 157BB8BF075924460025DA7A /* PBXContainerItemProxy */;
+               151F63DD09328A3C0096DCC9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
+                               PRODUCT_NAME = genSCPreferences;
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-four-char-constants",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Debug;
                };
-               157BB8C40759244B0025DA7A /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 157BB8AE075924360025DA7A /* configd_base */;
-                       targetProxy = 157BB8C30759244B0025DA7A /* PBXContainerItemProxy */;
+               151F63DE09328A3C0096DCC9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
+                               PRODUCT_NAME = genSCPreferences;
+                               WARNING_CFLAGS = (
+                                       "-Wall",
+                                       "-Wno-four-char-constants",
+                                       "-Wno-unknown-pragmas",
+                               );
+                       };
+                       name = Release;
                };
-               15828B070753B77E00AD4710 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */;
-                       targetProxy = 15828B060753B77E00AD4710 /* PBXContainerItemProxy */;
+               151FE2E50D5B7046000D6DB1 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd_base (EmbeddedSimulator)";
+                       };
+                       name = Debug;
                };
-               158317100CFB77D1006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 158316CF0CFB774B006F62B9 /* configd_base-Embedded */;
-                       targetProxy = 1583170F0CFB77D1006F62B9 /* PBXContainerItemProxy */;
+               151FE2E60D5B7046000D6DB1 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd_base (EmbeddedSimulator)";
+                       };
+                       name = Release;
                };
-               158317120CFB77E1006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 1572C4A60CFB55B400E2776E /* SystemConfiguration.framework-Embedded */;
-                       targetProxy = 158317110CFB77E1006F62B9 /* PBXContainerItemProxy */;
+               15213FFC0E93E9F600DACD2C /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/Logger/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = Logger;
+                       };
+                       name = Debug;
                };
-               158317140CFB77E8006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 158337990CFB6B9E0033AB93 /* SCHelper-Embedded */;
-                       targetProxy = 158317130CFB77E8006F62B9 /* PBXContainerItemProxy */;
+               15213FFD0E93E9F600DACD2C /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/Logger/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = Logger;
+                       };
+                       name = Release;
                };
-               158317160CFB783B006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 158316E30CFB7761006F62B9 /* configd_plugins-Embedded */;
-                       targetProxy = 158317150CFB783B006F62B9 /* PBXContainerItemProxy */;
+               156CA4830EF853BB00C59A18 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       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 = Debug;
                };
-               158317180CFB784D006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 158317040CFB7782006F62B9 /* configd_executables-Embedded */;
-                       targetProxy = 158317170CFB784D006F62B9 /* PBXContainerItemProxy */;
+               156CA4840EF853BB00C59A18 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       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;
                };
-               158317660CFB80D5006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 158317230CFB80A1006F62B9 /* configd-Embedded */;
-                       targetProxy = 158317650CFB80D5006F62B9 /* PBXContainerItemProxy */;
+               156EB5DB0905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               BUILD_VARIANTS = (
+                                       normal,
+                                       debug,
+                                       profile,
+                               );
+                               GENERATE_PROFILING_CODE_profile = YES;
+                               INSTALLHDRS_COPY_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/lib/system;
+                               MACH_O_TYPE = mh_dylib;
+                               OTHER_CFLAGS_debug = "-O0";
+                               OTHER_LDFLAGS = (
+                                       "-umbrella",
+                                       System,
+                               );
+                               OTHER_MIGFLAGS = "-DLIBDNSINFO";
+                               PRODUCT_NAME = libdnsinfo;
+                               STRIP_INSTALLED_PRODUCT_debug = NO;
+                               STRIP_INSTALLED_PRODUCT_normal = YES;
+                               STRIP_INSTALLED_PRODUCT_profile = NO;
+                       };
+                       name = Debug;
+               };
+               156EB5DC0905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               BUILD_VARIANTS = (
+                                       normal,
+                                       debug,
+                                       profile,
+                               );
+                               GENERATE_PROFILING_CODE_profile = YES;
+                               INSTALLHDRS_COPY_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/lib/system;
+                               MACH_O_TYPE = mh_dylib;
+                               OTHER_CFLAGS_debug = "-O0";
+                               OTHER_CFLAGS_normal = "";
+                               OTHER_CFLAGS_profile = "";
+                               OTHER_LDFLAGS = (
+                                       "-umbrella",
+                                       System,
+                               );
+                               OTHER_MIGFLAGS = "-DLIBDNSINFO";
+                               PRODUCT_NAME = libdnsinfo;
+                               STRIP_INSTALLED_PRODUCT_debug = NO;
+                               STRIP_INSTALLED_PRODUCT_normal = YES;
+                               STRIP_INSTALLED_PRODUCT_profile = NO;
+                       };
+                       name = Release;
+               };
+               156EB5DF0905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               FRAMEWORK_SEARCH_PATHS = (
+                                       "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks",
+                                       "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks",
+                               );
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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)";
+                               PRODUCT_NAME = SystemConfiguration;
+                               WRAPPER_EXTENSION = framework;
+                       };
+                       name = Debug;
+               };
+               156EB5E00905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               FRAMEWORK_SEARCH_PATHS = (
+                                       "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks",
+                                       "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks",
+                               );
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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)";
+                               PRODUCT_NAME = SystemConfiguration;
+                               SECTORDER_FLAGS = (
+                                       "-sectorder",
+                                       __TEXT,
+                                       __text,
+                                       "$(OBJROOT)/SystemConfiguration.order",
+                               );
+                               WRAPPER_EXTENSION = framework;
+                       };
+                       name = Release;
+               };
+               156EB5E30905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
+                               PRODUCT_NAME = SCHelper;
+                       };
+                       name = Debug;
+               };
+               156EB5E40905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
+                               PRODUCT_NAME = SCHelper;
+                       };
+                       name = Release;
                };
-               158317B30CFB8660006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 158317A00CFB8626006F62B9 /* NetworkIdentification.bundle-Embedded */;
-                       targetProxy = 158317B20CFB8660006F62B9 /* PBXContainerItemProxy */;
+               156EB5E70905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = configd_base;
+                       };
+                       name = Debug;
                };
-               158317B50CFB8660006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 158317980CFB860C006F62B9 /* LinkConfiguration.bundle-Embedded */;
-                       targetProxy = 158317B40CFB8660006F62B9 /* PBXContainerItemProxy */;
+               156EB5E80905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = configd_base;
+                       };
+                       name = Release;
                };
-               158317B70CFB8660006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 158317900CFB85F7006F62B9 /* KernelEventMonitor.bundle-Embedded */;
-                       targetProxy = 158317B60CFB8660006F62B9 /* PBXContainerItemProxy */;
+               156EB5EF0905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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 = IPMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                       };
+                       name = Debug;
                };
-               158317B90CFB8660006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 158317870CFB85DD006F62B9 /* InterfaceNamer.bundle-Embedded */;
-                       targetProxy = 158317B80CFB8660006F62B9 /* PBXContainerItemProxy */;
+               156EB5F00905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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 = IPMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                       };
+                       name = Release;
                };
-               158317BB0CFB8660006F62B9 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 1583177D0CFB85C8006F62B9 /* IPMonitor.bundle-Embedded */;
-                       targetProxy = 158317BA0CFB8660006F62B9 /* PBXContainerItemProxy */;
+               156EB5F30905594A00EEF749 /* Debug */ = {
+                       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 = Debug;
                };
-               158AD9860754E72500124717 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15FD72A10754DA4C001CC321 /* IPMonitor.bundle */;
-                       targetProxy = 158AD9850754E72500124717 /* PBXContainerItemProxy */;
+               156EB5F40905594A00EEF749 /* Release */ = {
+                       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 = Release;
                };
-               158AD9880754E72500124717 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */;
-                       targetProxy = 158AD9870754E72500124717 /* PBXContainerItemProxy */;
+               156EB5F70905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = InterfaceNamer;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                       };
+                       name = Debug;
                };
-               158AD98C0754E72500124717 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15FD72B10754DA69001CC321 /* LinkConfiguration.bundle */;
-                       targetProxy = 158AD98B0754E72500124717 /* PBXContainerItemProxy */;
+               156EB5F80905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = InterfaceNamer;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                       };
+                       name = Release;
                };
-               158AD98E0754E72500124717 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15FD72C50754DA7E001CC321 /* PreferencesMonitor.bundle */;
-                       targetProxy = 158AD98D0754E72500124717 /* PBXContainerItemProxy */;
+               156EB5FB0905594A00EEF749 /* Debug */ = {
+                       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 = Debug;
                };
-               159D542207528E85004F8947 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 159D53D307528BDA004F8947 /* KernelEventMonitor */;
-                       targetProxy = 159D542107528E85004F8947 /* PBXContainerItemProxy */;
+               156EB5FC0905594A00EEF749 /* Release */ = {
+                       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 = Release;
                };
-               159D542607528E85004F8947 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 159D53E407528C4A004F8947 /* InterfaceNamer */;
-                       targetProxy = 159D542507528E85004F8947 /* PBXContainerItemProxy */;
+               156EB5FF0905594A00EEF749 /* Debug */ = {
+                       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 = Debug;
                };
-               159D542807528E85004F8947 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 159D53EB07528C61004F8947 /* IPMonitor */;
-                       targetProxy = 159D542707528E85004F8947 /* PBXContainerItemProxy */;
+               156EB6000905594A00EEF749 /* Release */ = {
+                       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 = Release;
                };
-               159D542A07528E85004F8947 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 159D53F207528C79004F8947 /* LinkConfiguration */;
-                       targetProxy = 159D542907528E85004F8947 /* PBXContainerItemProxy */;
+               156EB6030905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                       };
+                       name = Debug;
                };
-               159D542C07528E85004F8947 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 159D53F907528C95004F8947 /* PreferencesMonitor */;
-                       targetProxy = 159D542B07528E85004F8947 /* PBXContainerItemProxy */;
+               156EB6040905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                       };
+                       name = Release;
                };
-               159D542E07529008004F8947 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 159D542007528E7C004F8947 /* configd_plugins */;
-                       targetProxy = 159D542D07529008004F8947 /* PBXContainerItemProxy */;
+               156EB60F0905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = LinkConfiguration;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                       };
+                       name = Debug;
                };
-               15A5A2710D5B942D0087BDA0 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15A5A1E40D5B94190087BDA0 /* SystemConfiguration.framework-EmbeddedSimulator */;
-                       targetProxy = 15A5A2700D5B942D0087BDA0 /* PBXContainerItemProxy */;
+               156EB6100905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = LinkConfiguration;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                       };
+                       name = Release;
                };
-               15C64A220F684C4900D78394 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15DAD5DF075913CE0084A6ED /* DNSConfiguration */;
-                       targetProxy = 15C64A210F684C4900D78394 /* PBXContainerItemProxy */;
+               156EB6130905594A00EEF749 /* Debug */ = {
+                       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 = Debug;
                };
-               15C64A240F684C5700D78394 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15C64A1E0F684C3300D78394 /* configd_libSystem */;
-                       targetProxy = 15C64A230F684C5700D78394 /* PBXContainerItemProxy */;
+               156EB6140905594A00EEF749 /* Release */ = {
+                       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 = Release;
                };
-               15C64A2F0F684C8300D78394 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 15C64A280F684C6B00D78394 /* configd_libSystem-Embedded */;
-                       targetProxy = 15C64A2E0F684C8300D78394 /* PBXContainerItemProxy */;
+               156EB6170905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = PreferencesMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                       };
+                       name = Debug;
                };
-               15C64A310F684C8F00D78394 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 157A84D80D56C63900B6F1A0 /* DNSConfiguration-Embedded */;
-                       targetProxy = 15C64A300F684C8F00D78394 /* PBXContainerItemProxy */;
+               156EB6180905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = PreferencesMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                       };
+                       name = Release;
+               };
+               156EB61B0905594A00EEF749 /* Debug */ = {
+                       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 = Debug;
                };
-               F95B8A770B03FB9100993BA3 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = F95B8A6A0B03F9D100993BA3 /* NetworkIdentification.bundle */;
-                       targetProxy = F95B8A760B03FB9100993BA3 /* PBXContainerItemProxy */;
+               156EB61C0905594A00EEF749 /* Release */ = {
+                       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 = Release;
                };
-               F95B8A790B03FB9100993BA3 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = F95B8A5E0B03F81400993BA3 /* NetworkIdentification */;
-                       targetProxy = F95B8A780B03FB9100993BA3 /* PBXContainerItemProxy */;
+               156EB61F0905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = configd_plugins;
+                       };
+                       name = Debug;
                };
-/* End PBXTargetDependency section */
-
-/* Begin PBXVariantGroup section */
-               1577253606EFBF3100D7B52B /* NetworkInterface.strings */ = {
-                       isa = PBXVariantGroup;
-                       children = (
-                               1577252F06EFB96700D7B52B /* English */,
-                       );
-                       name = NetworkInterface.strings;
-                       sourceTree = "<group>";
+               156EB6200905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = configd_plugins;
+                       };
+                       name = Release;
                };
-               15A6F7C20A4B266D00B907EA /* Localizable.strings */ = {
-                       isa = PBXVariantGroup;
-                       children = (
-                               15A6F7C30A4B266D00B907EA /* English */,
-                       );
-                       name = Localizable.strings;
-                       sourceTree = "<group>";
+               156EB6230905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/libexec;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       /usr/local/lib/SystemConfiguration,
+                               );
+                               PRODUCT_NAME = configd;
+                       };
+                       name = Debug;
                };
-               15FEE8180CD03CBB001312F9 /* Localizable.strings */ = {
-                       isa = PBXVariantGroup;
-                       children = (
-                               15FEE8160CD03CA3001312F9 /* English */,
-                       );
-                       name = Localizable.strings;
-                       sourceTree = "<group>";
+               156EB6240905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/libexec;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       /usr/local/lib/SystemConfiguration,
+                               );
+                               PRODUCT_NAME = configd;
+                       };
+                       name = Release;
                };
-/* End PBXVariantGroup section */
-
-/* Begin XCBuildConfiguration section */
-               151C1CC70CFB487000C5AFD6 /* Debug */ = {
+               156EB6270905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               PRODUCT_NAME = "configd (Aggregate/Embedded)";
+                               CODE_SIGN_IDENTITY = "-";
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               PRODUCT_NAME = scselect;
                        };
                        name = Debug;
                };
-               151C1CC80CFB487000C5AFD6 /* Release */ = {
+               156EB6280905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               PRODUCT_NAME = "configd (Aggregate/Embedded)";
+                               CODE_SIGN_IDENTITY = "-";
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               PRODUCT_NAME = scselect;
                        };
                        name = Release;
                };
-               151F5D9C0CCE98E60093AC3B /* Debug */ = {
+               156EB62B0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
+                               CODE_SIGN_IDENTITY = "-";
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               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;
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       /usr/local/lib/SystemConfiguration,
+                               );
+                               PRODUCT_NAME = scutil;
                        };
                        name = Debug;
                };
-               151F5D9D0CCE98E60093AC3B /* Release */ = {
+               156EB62C0905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
+                               CODE_SIGN_IDENTITY = "-";
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               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;
-                               WRAPPER_EXTENSION = plugin;
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       /usr/local/lib/SystemConfiguration,
+                               );
+                               PRODUCT_NAME = scutil;
                        };
                        name = Release;
                };
-               151F63DD09328A3C0096DCC9 /* Debug */ = {
+               156EB62F0905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = configd_executables;
+                       };
+                       name = Debug;
+               };
+               156EB6300905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = configd_executables;
+                       };
+                       name = Release;
+               };
+               156EB6330905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd (Aggregate)";
+                       };
+                       name = Debug;
+               };
+               156EB6340905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd (Aggregate)";
+                       };
+                       name = Release;
+               };
+               156EB63F0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
-                               INSTALLHDRS_SCRIPT_PHASE = YES;
-                               PRODUCT_NAME = genSCPreferences;
+                               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",
+                               );
+                               RUN_CLANG_STATIC_ANALYZER = YES;
+                               VERSIONING_SYSTEM = "apple-generic";
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Wno-four-char-constants",
                                        "-Wno-unknown-pragmas",
+                                       "-Wformat-security",
                                );
                        };
                        name = Debug;
                };
-               151F63DE09328A3C0096DCC9 /* Release */ = {
+               156EB6400905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               INSTALLHDRS_SCRIPT_PHASE = YES;
-                               PRODUCT_NAME = genSCPreferences;
+                               CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)";
+                               DEAD_CODE_STRIPPING = YES;
+                               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",
+                               );
+                               VERSIONING_SYSTEM = "apple-generic";
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Wno-four-char-constants",
                                        "-Wno-unknown-pragmas",
+                                       "-Wformat-security",
                                );
                        };
                        name = Release;
                };
-               151FE2E50D5B7046000D6DB1 /* Debug */ = {
+               1572C52A0CFB55B400E2776E /* Debug */ = {
                        isa = XCBuildConfiguration;
-                       baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = "configd_base (EmbeddedSimulator)";
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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;
                };
-               151FE2E60D5B7046000D6DB1 /* Release */ = {
+               1572C52B0CFB55B400E2776E /* Release */ = {
                        isa = XCBuildConfiguration;
-                       baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = "configd_base (EmbeddedSimulator)";
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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;
                };
-               15213FFC0E93E9F600DACD2C /* Debug */ = {
+               157433E90D4A8122002ACA73 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/Logger/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = Logger;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               PRODUCT_NAME = scselect;
                        };
                        name = Debug;
                };
-               15213FFD0E93E9F600DACD2C /* Release */ = {
+               157433EA0D4A8122002ACA73 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/Logger/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = Logger;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               PRODUCT_NAME = scselect;
                        };
                        name = Release;
                };
-               156CA4830EF853BB00C59A18 /* Debug */ = {
+               157434170D4A8137002ACA73 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = "Plugins/Logger/Info-Embedded.plist";
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = Logger;
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PRODUCT_NAME = scutil;
                        };
                        name = Debug;
                };
-               156CA4840EF853BB00C59A18 /* Release */ = {
+               157434180D4A8137002ACA73 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = "Plugins/Logger/Info-Embedded.plist";
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = Logger;
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PRODUCT_NAME = scutil;
                        };
                        name = Release;
                };
-               156EB5DB0905594A00EEF749 /* Debug */ = {
+               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;
+                               INSTALL_PATH = /usr/lib/system;
+                               MACH_O_TYPE = mh_dylib;
                                OTHER_CFLAGS_debug = "-O0";
+                               OTHER_CFLAGS_normal = "";
+                               OTHER_CFLAGS_profile = "";
+                               OTHER_LDFLAGS = (
+                                       "-umbrella",
+                                       System,
+                               );
                                OTHER_MIGFLAGS = "-DLIBDNSINFO";
-                               PRODUCT_NAME = dnsinfo;
-                               STRIPFLAGS = "";
+                               PRODUCT_NAME = libdnsinfo;
                                STRIP_INSTALLED_PRODUCT_debug = NO;
                                STRIP_INSTALLED_PRODUCT_normal = YES;
                                STRIP_INSTALLED_PRODUCT_profile = NO;
                        };
                        name = Debug;
                };
-               156EB5DC0905594A00EEF749 /* Release */ = {
+               157A84E60D56C63900B6F1A0 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
                                BUILD_VARIANTS = (
                                        normal,
                                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;
+                               INSTALL_PATH = /usr/lib/system;
+                               MACH_O_TYPE = mh_dylib;
                                OTHER_CFLAGS_debug = "-O0";
                                OTHER_CFLAGS_normal = "";
                                OTHER_CFLAGS_profile = "";
+                               OTHER_LDFLAGS = (
+                                       "-umbrella",
+                                       System,
+                               );
                                OTHER_MIGFLAGS = "-DLIBDNSINFO";
-                               PRODUCT_NAME = dnsinfo;
-                               STRIPFLAGS = "";
+                               PRODUCT_NAME = libdnsinfo;
                                STRIP_INSTALLED_PRODUCT_debug = NO;
                                STRIP_INSTALLED_PRODUCT_normal = YES;
                                STRIP_INSTALLED_PRODUCT_profile = NO;
                        };
                        name = Release;
                };
-               156EB5DF0905594A00EEF749 /* Debug */ = {
+               157A84FF0D56C7E800B6F1A0 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               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;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
-                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
-                               PRODUCT_NAME = SystemConfiguration;
-                               SECTORDER_FLAGS = (
-                                       "-sectorder",
-                                       __TEXT,
-                                       __text,
-                                       "$(OBJROOT)/SystemConfiguration.order",
-                               );
-                               WRAPPER_EXTENSION = framework;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = IPMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               156EB5E00905594A00EEF749 /* Release */ = {
+               157A85000D56C7E800B6F1A0 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               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;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
-                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
-                               PRODUCT_NAME = SystemConfiguration;
-                               SECTORDER_FLAGS = (
-                                       "-sectorder",
-                                       __TEXT,
-                                       __text,
-                                       "$(OBJROOT)/SystemConfiguration.order",
-                               );
-                               WRAPPER_EXTENSION = framework;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = IPMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               156EB5E30905594A00EEF749 /* Debug */ = {
+               157A850A0D56C8AA00B6F1A0 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               CODE_SIGN_IDENTITY = "-";
-                               COPY_PHASE_STRIP = NO;
-                               DEAD_CODE_STRIPPING = YES;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
-                               PRODUCT_NAME = SCHelper;
-                               STRIPFLAGS = "-S";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = InterfaceNamer;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               156EB5E40905594A00EEF749 /* Release */ = {
+               157A850B0D56C8AA00B6F1A0 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               CODE_SIGN_IDENTITY = "-";
-                               COPY_PHASE_STRIP = YES;
-                               DEAD_CODE_STRIPPING = YES;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
-                               PRODUCT_NAME = SCHelper;
-                               STRIPFLAGS = "-S";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = InterfaceNamer;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               156EB5E70905594A00EEF749 /* Debug */ = {
+               157A85200D56C8E000B6F1A0 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = configd_base;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               156EB5E80905594A00EEF749 /* Release */ = {
+               157A85210D56C8E000B6F1A0 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = configd_base;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               156EB5EB0905594A00EEF749 /* Debug */ = {
+               157A852B0D56C91100B6F1A0 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
-                               INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = ATconfig;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = LinkConfiguration;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               156EB5EC0905594A00EEF749 /* Release */ = {
+               157A852C0D56C91100B6F1A0 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
-                               INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = ATconfig;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = LinkConfiguration;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               156EB5EF0905594A00EEF749 /* Debug */ = {
+               157A85360D56C94F00B6F1A0 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = IPMonitor;
+                               PRODUCT_NAME = NetworkIdentification;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               156EB5F00905594A00EEF749 /* Release */ = {
+               157A85370D56C94F00B6F1A0 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = IPMonitor;
+                               PRODUCT_NAME = NetworkIdentification;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               156EB5F30905594A00EEF749 /* Debug */ = {
+               157A85410D56C96F00B6F1A0 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = IPMonitor;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = PreferencesMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               156EB5F40905594A00EEF749 /* Release */ = {
+               157A85420D56C96F00B6F1A0 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = IPMonitor;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = PreferencesMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               156EB5F70905594A00EEF749 /* Debug */ = {
+               158316D90CFB774B006F62B9 /* Debug */ = {
                        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;
-                               PRODUCT_NAME = InterfaceNamer;
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               PRODUCT_NAME = "configd_base (Embedded)";
                        };
                        name = Debug;
                };
-               156EB5F80905594A00EEF749 /* Release */ = {
+               158316DA0CFB774B006F62B9 /* Release */ = {
                        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;
-                               PRODUCT_NAME = InterfaceNamer;
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               PRODUCT_NAME = "configd_base (Embedded)";
                        };
                        name = Release;
                };
-               156EB5FB0905594A00EEF749 /* Debug */ = {
+               158317010CFB7761006F62B9 /* Debug */ = {
                        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;
+                               PRODUCT_NAME = "configd_plugins (Embedded)";
                        };
                        name = Debug;
                };
-               156EB5FC0905594A00EEF749 /* Release */ = {
+               158317020CFB7761006F62B9 /* Release */ = {
                        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;
+                               PRODUCT_NAME = "configd_plugins (Embedded)";
                        };
                        name = Release;
                };
-               156EB5FF0905594A00EEF749 /* Debug */ = {
+               1583170C0CFB7782006F62B9 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
+                               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;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = KernelEventMonitor;
+                               INSTALL_PATH = /usr/libexec;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PRODUCT_NAME = configd;
                        };
                        name = Debug;
                };
-               156EB6000905594A00EEF749 /* Release */ = {
+               1583175F0CFB80A1006F62B9 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
+                               APPLY_RULES_IN_COPY_FILES = YES;
+                               CODE_SIGN_ENTITLEMENTS = configd.tproj/entitlements.plist;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = KernelEventMonitor;
+                               INSTALL_PATH = /usr/libexec;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PRODUCT_NAME = configd;
                        };
                        name = Release;
                };
-               156EB6030905594A00EEF749 /* Debug */ = {
+               158317810CFB85C8006F62B9 /* 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";
+                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = KernelEventMonitor;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = IPMonitor;
                        };
                        name = Debug;
                };
-               156EB6040905594A00EEF749 /* Release */ = {
+               158317820CFB85C8006F62B9 /* 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";
+                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = KernelEventMonitor;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = IPMonitor;
                        };
                        name = Release;
                };
-               156EB60B0905594A00EEF749 /* Debug */ = {
+               1583178A0CFB85DD006F62B9 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/Kicker/Info.plist;
+                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = Kicker;
+                               PRODUCT_NAME = InterfaceNamer;
                        };
                        name = Debug;
                };
-               156EB60C0905594A00EEF749 /* Release */ = {
+               1583178B0CFB85DD006F62B9 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/Kicker/Info.plist;
+                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = Kicker;
+                               PRODUCT_NAME = InterfaceNamer;
                        };
                        name = Release;
                };
-               156EB60F0905594A00EEF749 /* Debug */ = {
+               158317930CFB85F7006F62B9 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = LinkConfiguration;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = KernelEventMonitor;
                        };
                        name = Debug;
                };
-               156EB6100905594A00EEF749 /* Release */ = {
+               158317940CFB85F7006F62B9 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = LinkConfiguration;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = KernelEventMonitor;
                        };
                        name = Release;
                };
-               156EB6130905594A00EEF749 /* Debug */ = {
+               1583179B0CFB860C006F62B9 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                        };
                        name = Debug;
                };
-               156EB6140905594A00EEF749 /* Release */ = {
+               1583179C0CFB860C006F62B9 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                        };
                        name = Release;
                };
-               156EB6170905594A00EEF749 /* Debug */ = {
+               158317A30CFB8626006F62B9 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
+                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = PreferencesMonitor;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = NetworkIdentification;
                        };
                        name = Debug;
                };
-               156EB6180905594A00EEF749 /* Release */ = {
+               158317A40CFB8626006F62B9 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
+                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = PreferencesMonitor;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = NetworkIdentification;
                        };
                        name = Release;
                };
-               156EB61B0905594A00EEF749 /* Debug */ = {
+               158317AB0CFB8639006F62B9 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                        };
                        name = Debug;
                };
-               156EB61C0905594A00EEF749 /* Release */ = {
+               158317AC0CFB8639006F62B9 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                        };
                        name = Release;
                };
-               156EB61F0905594A00EEF749 /* Debug */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               PRODUCT_NAME = configd_plugins;
-                       };
-                       name = Debug;
-               };
-               156EB6200905594A00EEF749 /* Release */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               PRODUCT_NAME = configd_plugins;
-                       };
-                       name = Release;
-               };
-               156EB6230905594A00EEF749 /* Debug */ = {
+               158337A70CFB6B9E0033AB93 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               CODE_SIGN_IDENTITY = "-";
-                               COPY_PHASE_STRIP = NO;
-                               DEAD_CODE_STRIPPING = YES;
+                               APPLY_RULES_IN_COPY_FILES = 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)",
-                                       /usr/local/lib/SystemConfiguration,
-                               );
-                               PRODUCT_NAME = configd;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework";
+                               PRODUCT_NAME = SCHelper;
                        };
                        name = Debug;
                };
-               156EB6240905594A00EEF749 /* Release */ = {
+               158337A80CFB6B9E0033AB93 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               CODE_SIGN_IDENTITY = "-";
-                               DEAD_CODE_STRIPPING = YES;
+                               APPLY_RULES_IN_COPY_FILES = 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)",
-                                       /usr/local/lib/SystemConfiguration,
-                               );
-                               PRODUCT_NAME = configd;
-                       };
-                       name = Release;
-               };
-               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;
-                               PRODUCT_NAME = scselect;
-                               STRIPFLAGS = "-S";
-                       };
-                       name = Debug;
-               };
-               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;
-                               PRODUCT_NAME = scselect;
-                               STRIPFLAGS = "-S";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework";
+                               PRODUCT_NAME = SCHelper;
                        };
                        name = Release;
                };
-               156EB62B0905594A00EEF749 /* Debug */ = {
+               1583E9EA1083959E00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               CODE_SIGN_IDENTITY = "-";
-                               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)",
-                                       /usr/local/lib/SystemConfiguration,
-                               );
-                               PREBINDING = NO;
-                               PRODUCT_NAME = scutil;
-                               STRIPFLAGS = "-S";
+                               PRODUCT_NAME = "configd (Aggregate/EmbeddedOther)";
                        };
                        name = Debug;
                };
-               156EB62C0905594A00EEF749 /* Release */ = {
+               1583E9EB1083959E00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               CODE_SIGN_IDENTITY = "-";
-                               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)",
-                                       /usr/local/lib/SystemConfiguration,
-                               );
-                               PREBINDING = YES;
-                               PRODUCT_NAME = scutil;
-                               STRIPFLAGS = "-S";
+                               PRODUCT_NAME = "configd (Aggregate/EmbeddedOther)";
                        };
                        name = Release;
                };
-               156EB62F0905594A00EEF749 /* Debug */ = {
+               1583EA02108395BB00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = configd_executables;
+                               INSTALL_PATH = /usr/local/lib/system;
+                               PRODUCT_NAME = "configd_libSystem (EmbeddedOther)";
                        };
                        name = Debug;
                };
-               156EB6300905594A00EEF749 /* Release */ = {
+               1583EA03108395BB00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = configd_executables;
+                               INSTALL_PATH = /usr/local/lib/system;
+                               PRODUCT_NAME = "configd_libSystem (EmbeddedOther)";
                        };
                        name = Release;
                };
-               156EB6330905594A00EEF749 /* Debug */ = {
+               1583EA0E108395BB00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = "configd (Aggregate)";
+                               BUILD_VARIANTS = (
+                                       normal,
+                                       debug,
+                                       profile,
+                               );
+                               GENERATE_PROFILING_CODE_profile = YES;
+                               INSTALLHDRS_COPY_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/lib/system;
+                               MACH_O_TYPE = mh_dylib;
+                               OTHER_CFLAGS_debug = "-O0";
+                               OTHER_CFLAGS_normal = "";
+                               OTHER_CFLAGS_profile = "";
+                               OTHER_LDFLAGS = (
+                                       "-umbrella",
+                                       System,
+                               );
+                               OTHER_MIGFLAGS = "-DLIBDNSINFO";
+                               PRODUCT_NAME = dnsinfo;
+                               STRIP_INSTALLED_PRODUCT_debug = NO;
+                               STRIP_INSTALLED_PRODUCT_normal = YES;
+                               STRIP_INSTALLED_PRODUCT_profile = NO;
                        };
                        name = Debug;
                };
-               156EB6340905594A00EEF749 /* Release */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               PRODUCT_NAME = "configd (Aggregate)";
-                       };
-                       name = Release;
-               };
-               156EB63F0905594A00EEF749 /* Debug */ = {
+               1583EA0F108395BB00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        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",
+                               BUILD_VARIANTS = (
+                                       normal,
+                                       debug,
+                                       profile,
                                );
-                               STRIPFLAGS = "-S";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-four-char-constants",
-                                       "-Wno-unknown-pragmas",
-                                       "-Wformat-security",
+                               GENERATE_PROFILING_CODE_profile = YES;
+                               INSTALLHDRS_COPY_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/lib/system;
+                               MACH_O_TYPE = mh_dylib;
+                               OTHER_CFLAGS_debug = "-O0";
+                               OTHER_CFLAGS_normal = "";
+                               OTHER_CFLAGS_profile = "";
+                               OTHER_LDFLAGS = (
+                                       "-umbrella",
+                                       System,
                                );
+                               OTHER_MIGFLAGS = "-DLIBDNSINFO";
+                               PRODUCT_NAME = dnsinfo;
+                               STRIP_INSTALLED_PRODUCT_debug = NO;
+                               STRIP_INSTALLED_PRODUCT_normal = YES;
+                               STRIP_INSTALLED_PRODUCT_profile = NO;
                        };
-                       name = Debug;
+                       name = Release;
                };
-               156EB6400905594A00EEF749 /* Release */ = {
+               1583EA17108395BB00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)";
-                               DEAD_CODE_STRIPPING = YES;
-                               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",
-                               );
+                               PRODUCT_NAME = "configd_base (EmbeddedOther)";
+                       };
+                       name = Debug;
+               };
+               1583EA18108395BB00A3BC0C /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd_base (EmbeddedOther)";
                        };
                        name = Release;
                };
-               1572C52A0CFB55B400E2776E /* Debug */ = {
+               1583EA97108395BB00A3BC0C /* 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";
+                               GCC_PREPROCESSOR_DEFINITIONS = TARGET_OS_EMBEDDED_OTHER;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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";
                        };
                        name = Debug;
                };
-               1572C52B0CFB55B400E2776E /* Release */ = {
+               1583EA98108395BB00A3BC0C /* 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";
+                               GCC_PREPROCESSOR_DEFINITIONS = TARGET_OS_EMBEDDED_OTHER;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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";
                        };
                        name = Release;
                };
-               157433E90D4A8122002ACA73 /* Debug */ = {
+               1583EAA8108395BB00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               DEAD_CODE_STRIPPING = YES;
+                               APPLY_RULES_IN_COPY_FILES = 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";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework";
+                               PRODUCT_NAME = SCHelper;
                        };
                        name = Debug;
                };
-               157433EA0D4A8122002ACA73 /* Release */ = {
+               1583EAA9108395BB00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               DEAD_CODE_STRIPPING = YES;
+                               APPLY_RULES_IN_COPY_FILES = 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";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework";
+                               PRODUCT_NAME = SCHelper;
                        };
                        name = Release;
                };
-               157434170D4A8137002ACA73 /* Debug */ = {
+               1583EAC8108395BB00A3BC0C /* 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";
+                               PRODUCT_NAME = "configd_plugins (EmbeddedOther)";
                        };
                        name = Debug;
                };
-               157434180D4A8137002ACA73 /* Release */ = {
+               1583EAC9108395BB00A3BC0C /* 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";
+                               PRODUCT_NAME = "configd_plugins (EmbeddedOther)";
                        };
                        name = Release;
                };
-               157A84E50D56C63900B6F1A0 /* Debug */ = {
+               1583EAD6108395BB00A3BC0C /* 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;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/system;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                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;
+                               PRODUCT_NAME = IPMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               157A84E60D56C63900B6F1A0 /* Release */ = {
+               1583EAD7108395BB00A3BC0C /* 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;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/system;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                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;
+                               PRODUCT_NAME = IPMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               157A84FF0D56C7E800B6F1A0 /* Debug */ = {
+               1583EADC108395BB00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = IPMonitor;
                        };
                        name = Debug;
                };
-               157A85000D56C7E800B6F1A0 /* Release */ = {
+               1583EADD108395BB00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = IPMonitor;
                        };
                        name = Release;
                };
-               157A850A0D56C8AA00B6F1A0 /* Debug */ = {
+               1583EAE5108395BB00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                PRODUCT_NAME = InterfaceNamer;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               157A850B0D56C8AA00B6F1A0 /* Release */ = {
+               1583EAE6108395BB00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                PRODUCT_NAME = InterfaceNamer;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               157A85200D56C8E000B6F1A0 /* Debug */ = {
+               1583EAEB108395BC00A3BC0C /* 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";
+                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = KernelEventMonitor;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = InterfaceNamer;
                        };
                        name = Debug;
                };
-               157A85210D56C8E000B6F1A0 /* Release */ = {
+               1583EAEC108395BC00A3BC0C /* 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";
+                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = KernelEventMonitor;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = InterfaceNamer;
                        };
                        name = Release;
                };
-               157A852B0D56C91100B6F1A0 /* Debug */ = {
+               1583EAFD108395BC00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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 = LinkConfiguration;
+                               PRODUCT_NAME = KernelEventMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               157A852C0D56C91100B6F1A0 /* Release */ = {
+               1583EAFE108395BC00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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 = LinkConfiguration;
+                               PRODUCT_NAME = KernelEventMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               157A85360D56C94F00B6F1A0 /* Debug */ = {
+               1583EB03108395BC00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
+                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = NetworkIdentification;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = KernelEventMonitor;
                        };
                        name = Debug;
                };
-               157A85370D56C94F00B6F1A0 /* Release */ = {
+               1583EB04108395BC00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
+                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = NetworkIdentification;
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = KernelEventMonitor;
                        };
                        name = Release;
                };
-               157A85410D56C96F00B6F1A0 /* Debug */ = {
+               1583EB0C108395BC00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = PreferencesMonitor;
+                               PRODUCT_NAME = LinkConfiguration;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               157A85420D56C96F00B6F1A0 /* Release */ = {
+               1583EB0D108395BC00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                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)";
+                               PRODUCT_NAME = LinkConfiguration;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               158317010CFB7761006F62B9 /* Debug */ = {
+               1583EB12108395BC00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = "configd_plugins (Embedded)";
+                               INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = LinkConfiguration;
                        };
                        name = Debug;
                };
-               158317020CFB7761006F62B9 /* Release */ = {
+               1583EB13108395BC00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = "configd_plugins (Embedded)";
+                               INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = LinkConfiguration;
                        };
                        name = Release;
                };
-               1583170C0CFB7782006F62B9 /* Debug */ = {
+               1583EB1F108395BC00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = "configd_executables (Embedded)";
+                               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;
                };
-               1583170D0CFB7782006F62B9 /* Release */ = {
+               1583EB20108395BC00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               PRODUCT_NAME = "configd_executables (Embedded)";
+                               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;
                };
-               1583175E0CFB80A1006F62B9 /* Debug */ = {
+               1583EB28108395BD00A3BC0C /* 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;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/libexec;
-                               LIBRARY_SEARCH_PATHS = (
-                                       "$(SYMROOT)",
-                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
-                               );
-                               PRODUCT_NAME = configd;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = NetworkIdentification;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               1583175F0CFB80A1006F62B9 /* Release */ = {
+               1583EB29108395BD00A3BC0C /* 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;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/libexec;
-                               LIBRARY_SEARCH_PATHS = (
-                                       "$(SYMROOT)",
-                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
-                               );
-                               PRODUCT_NAME = configd;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = NetworkIdentification;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               158317810CFB85C8006F62B9 /* Debug */ = {
+               1583EB2E108395BD00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
+                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = IPMonitor;
+                               PRODUCT_NAME = NetworkIdentification;
                        };
                        name = Debug;
                };
-               158317820CFB85C8006F62B9 /* Release */ = {
+               1583EB2F108395BD00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
+                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = IPMonitor;
+                               PRODUCT_NAME = NetworkIdentification;
                        };
                        name = Release;
                };
-               1583178A0CFB85DD006F62B9 /* Debug */ = {
+               1583EB37108395BD00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = InterfaceNamer;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = PreferencesMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
-               1583178B0CFB85DD006F62B9 /* Release */ = {
+               1583EB38108395BD00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = InterfaceNamer;
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = PreferencesMonitor;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
-               158317930CFB85F7006F62B9 /* Debug */ = {
+               1583EB3D108395BD00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
+                               INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = KernelEventMonitor;
+                               PRODUCT_NAME = PreferencesMonitor;
                        };
                        name = Debug;
                };
-               158317940CFB85F7006F62B9 /* Release */ = {
+               1583EB3E108395BD00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
+                               INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = KernelEventMonitor;
+                               PRODUCT_NAME = PreferencesMonitor;
                        };
                        name = Release;
                };
-               1583179B0CFB860C006F62B9 /* Debug */ = {
+               1583EB49108395BD00A3BC0C /* 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;
+                               PRODUCT_NAME = "configd_executables (EmbeddedOther)";
                        };
                        name = Debug;
                };
-               1583179C0CFB860C006F62B9 /* Release */ = {
+               1583EB4A108395BD00A3BC0C /* 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;
+                               PRODUCT_NAME = "configd_executables (EmbeddedOther)";
                        };
                        name = Release;
                };
-               158317A30CFB8626006F62B9 /* Debug */ = {
+               1583EB82108395BD00A3BC0C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
+                               APPLY_RULES_IN_COPY_FILES = YES;
+                               CODE_SIGN_ENTITLEMENTS = configd.tproj/entitlements.plist;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_PREPROCESSOR_DEFINITIONS = TARGET_OS_EMBEDDED_OTHER;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = NetworkIdentification;
+                               INSTALL_PATH = /usr/libexec;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PRODUCT_NAME = configd;
                        };
                        name = Debug;
                };
-               158317A40CFB8626006F62B9 /* Release */ = {
+               1583EB83108395BD00A3BC0C /* Release */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
+                               APPLY_RULES_IN_COPY_FILES = YES;
+                               CODE_SIGN_ENTITLEMENTS = configd.tproj/entitlements.plist;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_PREPROCESSOR_DEFINITIONS = TARGET_OS_EMBEDDED_OTHER;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = NetworkIdentification;
+                               INSTALL_PATH = /usr/libexec;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PRODUCT_NAME = configd;
                        };
                        name = Release;
                };
-               158317AB0CFB8639006F62B9 /* Debug */ = {
+               1583EB8E108395BE00A3BC0C /* 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;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               PRODUCT_NAME = scselect;
                        };
                        name = Debug;
                };
-               158317AC0CFB8639006F62B9 /* Release */ = {
+               1583EB8F108395BE00A3BC0C /* 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;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               PRODUCT_NAME = scselect;
                        };
                        name = Release;
                };
-               158337A70CFB6B9E0033AB93 /* Debug */ = {
+               1583EBB4108395BE00A3BC0C /* 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";
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PRODUCT_NAME = scutil;
                        };
                        name = Debug;
                };
-               158337A80CFB6B9E0033AB93 /* Release */ = {
+               1583EBB5108395BE00A3BC0C /* 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;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework";
-                               PRODUCT_NAME = SCHelper;
-                               STRIPFLAGS = "-S";
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PRODUCT_NAME = scutil;
                        };
                        name = Release;
                };
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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_ACTUAL = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
                                LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
+                               OTHER_CFLAGS = (
+                                       "-idirafter",
+                                       "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders",
+                               );
                                PRODUCT_NAME = SystemConfiguration;
                                WRAPPER_EXTENSION = framework;
                        };
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               HEADER_SEARCH_PATHS = "$(SDKROOT)$(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_ACTUAL = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
                                LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
+                               OTHER_CFLAGS = (
+                                       "-idirafter",
+                                       "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders",
+                               );
                                PRODUCT_NAME = SystemConfiguration;
                                WRAPPER_EXTENSION = framework;
                        };
                };
                15C64A2C0F684C6B00D78394 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
                                INSTALL_PATH = /usr/local/lib/system;
                                PRODUCT_NAME = "configd_libSystem (Embedded)";
                };
                15C64A2D0F684C6B00D78394 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
                                INSTALL_PATH = /usr/local/lib/system;
                                PRODUCT_NAME = "configd_libSystem (Embedded)";
                F95B8A620B03F83200993BA3 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                PRODUCT_NAME = NetworkIdentification;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Debug;
                };
                F95B8A630B03F83200993BA3 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                PRODUCT_NAME = NetworkIdentification;
+                               STRIP_INSTALLED_PRODUCT = NO;
                        };
                        name = Release;
                };
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Release;
                };
-               156EB5EA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig.bundle" */ = {
-                       isa = XCConfigurationList;
-                       buildConfigurations = (
-                               156EB5EB0905594A00EEF749 /* Debug */,
-                               156EB5EC0905594A00EEF749 /* Release */,
-                       );
-                       defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Release;
-               };
                156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Release;
                };
-               156EB60A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker.bundle" */ = {
-                       isa = XCConfigurationList;
-                       buildConfigurations = (
-                               156EB60B0905594A00EEF749 /* Debug */,
-                               156EB60C0905594A00EEF749 /* Release */,
-                       );
-                       defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Release;
-               };
                156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Release;
                };
+               1583E9E91083959E00A3BC0C /* Build configuration list for PBXAggregateTarget "All-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583E9EA1083959E00A3BC0C /* Debug */,
+                               1583E9EB1083959E00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EA01108395BB00A3BC0C /* Build configuration list for PBXAggregateTarget "configd_libSystem-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EA02108395BB00A3BC0C /* Debug */,
+                               1583EA03108395BB00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EA0D108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "DNSConfiguration-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EA0E108395BB00A3BC0C /* Debug */,
+                               1583EA0F108395BB00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EA16108395BB00A3BC0C /* Build configuration list for PBXAggregateTarget "configd_base-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EA17108395BB00A3BC0C /* Debug */,
+                               1583EA18108395BB00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EA96108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EA97108395BB00A3BC0C /* Debug */,
+                               1583EA98108395BB00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EAA7108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "SCHelper-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EAA8108395BB00A3BC0C /* Debug */,
+                               1583EAA9108395BB00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EAC7108395BB00A3BC0C /* Build configuration list for PBXAggregateTarget "configd_plugins-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EAC8108395BB00A3BC0C /* Debug */,
+                               1583EAC9108395BB00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EAD5108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "IPMonitor-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EAD6108395BB00A3BC0C /* Debug */,
+                               1583EAD7108395BB00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EADB108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "IPMonitor.bundle-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EADC108395BB00A3BC0C /* Debug */,
+                               1583EADD108395BB00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EAE4108395BB00A3BC0C /* Build configuration list for PBXNativeTarget "InterfaceNamer-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EAE5108395BB00A3BC0C /* Debug */,
+                               1583EAE6108395BB00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EAEA108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EAEB108395BC00A3BC0C /* Debug */,
+                               1583EAEC108395BC00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EAFC108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "KernelEventMonitor-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EAFD108395BC00A3BC0C /* Debug */,
+                               1583EAFE108395BC00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB02108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB03108395BC00A3BC0C /* Debug */,
+                               1583EB04108395BC00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB0B108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "LinkConfiguration-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB0C108395BC00A3BC0C /* Debug */,
+                               1583EB0D108395BC00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB11108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB12108395BC00A3BC0C /* Debug */,
+                               1583EB13108395BC00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB1E108395BC00A3BC0C /* Build configuration list for PBXNativeTarget "Logger.bundle-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB1F108395BC00A3BC0C /* Debug */,
+                               1583EB20108395BC00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB27108395BD00A3BC0C /* Build configuration list for PBXNativeTarget "NetworkIdentification-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB28108395BD00A3BC0C /* Debug */,
+                               1583EB29108395BD00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB2D108395BD00A3BC0C /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB2E108395BD00A3BC0C /* Debug */,
+                               1583EB2F108395BD00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB36108395BD00A3BC0C /* Build configuration list for PBXNativeTarget "PreferencesMonitor-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB37108395BD00A3BC0C /* Debug */,
+                               1583EB38108395BD00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB3C108395BD00A3BC0C /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB3D108395BD00A3BC0C /* Debug */,
+                               1583EB3E108395BD00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB48108395BD00A3BC0C /* Build configuration list for PBXAggregateTarget "configd_executables-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB49108395BD00A3BC0C /* Debug */,
+                               1583EB4A108395BD00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB81108395BD00A3BC0C /* Build configuration list for PBXNativeTarget "configd-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB82108395BD00A3BC0C /* Debug */,
+                               1583EB83108395BD00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EB8D108395BE00A3BC0C /* Build configuration list for PBXNativeTarget "scselect-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EB8E108395BE00A3BC0C /* Debug */,
+                               1583EB8F108395BE00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583EBB3108395BE00A3BC0C /* Build configuration list for PBXNativeTarget "scutil-EmbeddedOther" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583EBB4108395BE00A3BC0C /* Debug */,
+                               1583EBB5108395BE00A3BC0C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
                15A5A2660D5B94190087BDA0 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-EmbeddedSimulator" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
index 792591edb414a9b8a4c0971f96eaa5ab87f2ed12..870030528c90a0070824ab30b7977ecaf067262d 100644 (file)
@@ -35,6 +35,8 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 
+#define        DNSINFO_VERSION         20091104
+
 #define DEFAULT_SEARCH_ORDER    200000   /* search order for the "default" resolver domain name */
 
 #define        DNS_PTR(type, name)                             \
@@ -68,16 +70,23 @@ typedef struct {
        DNS_PTR(char *,                 options);       /* options */
        DNS_VAR(uint32_t,               timeout);       /* timeout */
        DNS_VAR(uint32_t,               search_order);  /* search_order */
-       DNS_VAR(uint32_t,               reserved[8]);
+       DNS_VAR(uint32_t,               if_index);
+       DNS_VAR(uint32_t,               flags);
+       DNS_VAR(uint32_t,               reserved[6]);
 } dns_resolver_t;
 #pragma pack()
 
 
+#define DNS_RESOLVER_FLAGS_SCOPED      1
+
+
 #pragma pack(4)
 typedef struct {
-       DNS_VAR(int32_t,                n_resolver);    /* resolver configurations */
+       DNS_VAR(int32_t,                n_resolver);            /* resolver configurations */
        DNS_PTR(dns_resolver_t **,      resolver);
-       DNS_VAR(uint32_t,               reserved[8]);
+       DNS_VAR(int32_t,                n_scoped_resolver);     /* "scoped" resolver configurations */
+       DNS_PTR(dns_resolver_t **,      scoped_resolver);
+       DNS_VAR(uint32_t,               reserved[5]);
 } dns_config_t;
 #pragma pack()
 
index ab536e786f38783177282e1148a9c54d4e20161c..1a2ea6f0be7f6fb72c89ec6210cc40ba6ac38709 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004, 2006, 2008-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -80,6 +80,9 @@ add_list(void **padding, uint32_t *n_padding, int32_t count, int32_t size, void
 }
 
 
+#define        DNS_CONFIG_BUF_MAX      1024*1024
+
+
 static _dns_config_buf_t *
 copy_dns_info()
 {
@@ -102,7 +105,7 @@ copy_dns_info()
                        }
 
                        // our [cached] server port is not valid
-                       if (status != MACH_SEND_INVALID_DEST) {
+                       if ((status != MACH_SEND_INVALID_DEST) && (status != MIG_SERVER_DIED)) {
                                // if we got an unexpected error, don't retry
                                fprintf(stderr,
                                        "dns_configuration_copy shared_dns_infoGet(): %s\n",
@@ -133,15 +136,18 @@ copy_dns_info()
        }
 
        if (dataRef != NULL) {
-               if (dataLen >= sizeof(_dns_config_buf_t)) {
+               if ((dataLen >= sizeof(_dns_config_buf_t)) && (dataLen <= DNS_CONFIG_BUF_MAX)) {
                        _dns_config_buf_t       *config         = (_dns_config_buf_t *)dataRef;
-                       uint32_t                len;
                        uint32_t                n_padding       = ntohl(config->n_padding);
 
-                       len = dataLen + n_padding;
-                       buf = malloc(len);
-                       bcopy((void *)dataRef, buf, dataLen);
-                       bzero(&buf[dataLen], n_padding);
+                       if (n_padding <= (DNS_CONFIG_BUF_MAX - dataLen)) {
+                               uint32_t        len;
+
+                               len = dataLen + n_padding;
+                               buf = malloc(len);
+                               bcopy((void *)dataRef, buf, dataLen);
+                               bzero(&buf[dataLen], n_padding);
+                       }
                }
 
                status = vm_deallocate(mach_task_self(), (vm_address_t)dataRef, dataLen);
@@ -223,6 +229,14 @@ expand_resolver(_dns_resolver_buf_t *buf, uint32_t n_buf, void **padding, uint32
 
        resolver->search_order = ntohl(resolver->search_order);
 
+       // initialize if_index
+
+       resolver->if_index = ntohl(resolver->if_index);
+
+       // initialize flags
+
+       resolver->flags = ntohl(resolver->flags);
+
        // process resolver buffer "attribute" data
 
        n_attribute = n_buf - sizeof(_dns_resolver_buf_t);
@@ -281,10 +295,11 @@ static dns_config_t *
 expand_config(_dns_config_buf_t *buf)
 {
        dns_attribute_t         *attribute;
-       dns_config_t            *config         = (dns_config_t *)buf;
+       dns_config_t            *config                 = (dns_config_t *)buf;
        uint32_t                n_attribute;
        uint32_t                n_padding;
-       int32_t                 n_resolver      = 0;
+       int32_t                 n_resolver              = 0;
+       int32_t                 n_scoped_resolver       = 0;
        void                    *padding;
 
        // establish padding
@@ -292,7 +307,7 @@ expand_config(_dns_config_buf_t *buf)
        padding   = &buf->attribute[ntohl(buf->n_attribute)];
        n_padding = ntohl(buf->n_padding);
 
-       // initialize resolver list
+       // initialize resolver lists
 
        config->n_resolver = ntohl(config->n_resolver);
        if (!add_list(&padding,
@@ -303,16 +318,27 @@ expand_config(_dns_config_buf_t *buf)
                goto error;
        }
 
+       config->n_scoped_resolver = ntohl(config->n_scoped_resolver);
+       if (!add_list(&padding,
+                     &n_padding,
+                     config->n_scoped_resolver,
+                     sizeof(DNS_PTR(dns_resolver_t *, x)),
+                     (void **)&config->scoped_resolver)) {
+               goto error;
+       }
+
        // process configuration buffer "attribute" data
 
        n_attribute = ntohl(buf->n_attribute);
        attribute   = (dns_attribute_t *)&buf->attribute[0];
 
        while (n_attribute >= sizeof(dns_attribute_t)) {
-               int32_t attribute_length        = ntohl(attribute->length);
+               uint32_t        attribute_length        = ntohl(attribute->length);
+               uint32_t        attribute_type          = ntohl(attribute->type);
 
-               switch (ntohl(attribute->type)) {
-                       case CONFIG_ATTRIBUTE_RESOLVER : {
+               switch (attribute_type) {
+                       case CONFIG_ATTRIBUTE_RESOLVER :
+                       case CONFIG_ATTRIBUTE_SCOPED_RESOLVER   : {
                                dns_resolver_t  *resolver;
 
                                // expand resolver buffer
@@ -327,7 +353,11 @@ expand_config(_dns_config_buf_t *buf)
 
                                // add resolver to config list
 
-                               config->resolver[n_resolver++] = resolver;
+                               if (attribute_type == CONFIG_ATTRIBUTE_RESOLVER) {
+                                       config->resolver[n_resolver++] = resolver;
+                               } else {
+                                       config->scoped_resolver[n_scoped_resolver++] = resolver;
+                               }
 
                                break;
                        }
@@ -344,6 +374,10 @@ expand_config(_dns_config_buf_t *buf)
                goto error;
        }
 
+       if (n_scoped_resolver != config->n_scoped_resolver) {
+               goto error;
+       }
+
        return config;
 
     error :
@@ -355,7 +389,13 @@ expand_config(_dns_config_buf_t *buf)
 const char *
 dns_configuration_notify_key()
 {
-       return _dns_configuration_notify_key();
+       const char      *key;
+
+       // initialize runtime
+       pthread_once(&_dns_initialized, __dns_initialize);
+
+       key = _dns_configuration_notify_key();
+       return key;
 }
 
 
@@ -390,3 +430,20 @@ dns_configuration_free(dns_config_t *config)
        free((void *)config);
        return;
 }
+
+#ifdef MAIN
+
+int
+main(int argc, char **argv)
+{
+       dns_config_t    *config;
+
+       config = dns_configuration_copy();
+       if (config != NULL) {
+               dns_configuration_free(&config);
+       }
+
+       exit(0);
+}
+
+#endif
index 6cd07e064b182bb7d3d06c4398e145178a9feba6..820797aae0a3bbb61bdb60dd62b7e3f21448b0f9 100644 (file)
@@ -132,13 +132,21 @@ _dns_configuration_add_resolver(dns_create_config_t     *_config,
                padding += ntohl(resolver->resolver.n_sortaddr) * sizeof(DNS_PTR(dns_sortaddr_t *, x));
        }
 
-       config->config.n_resolver = htonl(ntohl(config->config.n_resolver) + 1);
-
-       config_add_attribute(_config,
-                            CONFIG_ATTRIBUTE_RESOLVER,
-                            sizeof(_dns_resolver_buf_t) + ntohl(resolver->n_attribute),
-                            (void *)resolver,
-                            padding);
+       if ((ntohl(resolver->resolver.flags) & DNS_RESOLVER_FLAGS_SCOPED) == 0) {
+               config->config.n_resolver = htonl(ntohl(config->config.n_resolver) + 1);
+               config_add_attribute(_config,
+                                    CONFIG_ATTRIBUTE_RESOLVER,
+                                    sizeof(_dns_resolver_buf_t) + ntohl(resolver->n_attribute),
+                                    (void *)resolver,
+                                    padding);
+       } else {
+               config->config.n_scoped_resolver = htonl(ntohl(config->config.n_scoped_resolver) + 1);
+               config_add_attribute(_config,
+                                    CONFIG_ATTRIBUTE_SCOPED_RESOLVER,
+                                    sizeof(_dns_resolver_buf_t) + ntohl(resolver->n_attribute),
+                                    (void *)resolver,
+                                    padding);
+       }
 
        return;
 }
@@ -247,52 +255,51 @@ _dns_resolver_add_attribute(dns_create_resolver_t *_resolver,
 
 
 void
-_dns_resolver_set_domain(dns_create_resolver_t *_resolver, const char *domain)
+_dns_resolver_add_nameserver(dns_create_resolver_t *_resolver, struct sockaddr *nameserver)
 {
-       _dns_resolver_add_attribute(_resolver, RESOLVER_ATTRIBUTE_DOMAIN, strlen(domain) + 1, (void *)domain);
+       _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
+
+       resolver->resolver.n_nameserver = htonl(ntohl(resolver->resolver.n_nameserver) + 1);
+       _dns_resolver_add_attribute(_resolver, RESOLVER_ATTRIBUTE_ADDRESS, nameserver->sa_len, (void *)nameserver);
        return;
 }
 
 
 void
-_dns_resolver_add_nameserver(dns_create_resolver_t *_resolver, struct sockaddr *nameserver)
+_dns_resolver_add_search(dns_create_resolver_t *_resolver, const char *search)
 {
        _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
 
-       resolver->resolver.n_nameserver = htonl(ntohl(resolver->resolver.n_nameserver) + 1);
-       _dns_resolver_add_attribute(_resolver, RESOLVER_ATTRIBUTE_ADDRESS, nameserver->sa_len, (void *)nameserver);
+       resolver->resolver.n_search = htonl(ntohl(resolver->resolver.n_search) + 1);
+       _dns_resolver_add_attribute(_resolver, RESOLVER_ATTRIBUTE_SEARCH, strlen(search) + 1, (void *)search);
        return;
 }
 
 
 void
-_dns_resolver_set_port(dns_create_resolver_t *_resolver, uint16_t port)
+_dns_resolver_set_domain(dns_create_resolver_t *_resolver, const char *domain)
 {
-       _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
-
-       resolver->resolver.port = htons(port);
+       _dns_resolver_add_attribute(_resolver, RESOLVER_ATTRIBUTE_DOMAIN, strlen(domain) + 1, (void *)domain);
        return;
 }
 
 
 void
-_dns_resolver_add_search(dns_create_resolver_t *_resolver, const char *search)
+_dns_resolver_set_flags(dns_create_resolver_t *_resolver, uint32_t flags)
 {
        _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
 
-       resolver->resolver.n_search = htonl(ntohl(resolver->resolver.n_search) + 1);
-       _dns_resolver_add_attribute(_resolver, RESOLVER_ATTRIBUTE_SEARCH, strlen(search) + 1, (void *)search);
+       resolver->resolver.flags = htonl(flags);
        return;
 }
 
 
 void
-_dns_resolver_add_sortaddr(dns_create_resolver_t *_resolver, dns_sortaddr_t *sortaddr)
+_dns_resolver_set_if_index(dns_create_resolver_t *_resolver, uint32_t if_index)
 {
        _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
 
-       resolver->resolver.n_sortaddr = htonl(ntohl(resolver->resolver.n_sortaddr) + 1);
-       _dns_resolver_add_attribute(_resolver, RESOLVER_ATTRIBUTE_SORTADDR, sizeof(dns_sortaddr_t), (void *)sortaddr);
+       resolver->resolver.if_index = htonl(if_index);
        return;
 }
 
@@ -306,21 +313,42 @@ _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)
+_dns_resolver_set_order(dns_create_resolver_t *_resolver, uint32_t order)
 {
        _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
 
-       resolver->resolver.timeout = htonl(timeout);
+       resolver->resolver.search_order = htonl(order);
        return;
 }
 
 
 void
-_dns_resolver_set_order(dns_create_resolver_t *_resolver, uint32_t order)
+_dns_resolver_set_port(dns_create_resolver_t *_resolver, uint16_t port)
 {
        _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
 
-       resolver->resolver.search_order = htonl(order);
+       resolver->resolver.port = htons(port);
+       return;
+}
+
+
+void
+_dns_resolver_add_sortaddr(dns_create_resolver_t *_resolver, dns_sortaddr_t *sortaddr)
+{
+       _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
+
+       resolver->resolver.n_sortaddr = htonl(ntohl(resolver->resolver.n_sortaddr) + 1);
+       _dns_resolver_add_attribute(_resolver, RESOLVER_ATTRIBUTE_SORTADDR, sizeof(dns_sortaddr_t), (void *)sortaddr);
+       return;
+}
+
+
+void
+_dns_resolver_set_timeout(dns_create_resolver_t *_resolver, uint32_t timeout)
+{
+       _dns_resolver_buf_t     *resolver       = (_dns_resolver_buf_t *)*_resolver;
+
+       resolver->resolver.timeout = htonl(timeout);
        return;
 }
 
index 2e01860d1cae9fe88e3dba1f8781010f7bca3cb3..5ad526d737c2cde9926eb58098c5fb38f1f56a9f 100644 (file)
@@ -91,11 +91,6 @@ 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
-
 __private_extern__
 void
 _dns_resolver_add_search       (dns_create_resolver_t  *_resolver,
@@ -108,19 +103,34 @@ _dns_resolver_add_sortaddr        (dns_create_resolver_t  *_resolver,
 
 __private_extern__
 void
-_dns_resolver_set_options      (dns_create_resolver_t  *_resolver,
-                                const char             *options)               /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+_dns_resolver_set_flags                (dns_create_resolver_t  *_resolver,
+                                uint32_t               flags)                  /*__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_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)*/;
+_dns_resolver_set_if_index     (dns_create_resolver_t  *_resolver,
+                                uint32_t               if_index)               /*__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_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_order                (dns_create_resolver_t  *_resolver,
                                 uint32_t               order)                  /*__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
+
+__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_free             (dns_create_resolver_t  *_resolver)             /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
index 378be841b2a48339f5ab3d08b70b51b3d457a1d3..664fcb4de0711125d63f1fd254ddafb3dd3f6ce6 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <net/if.h>
 #include <sys/dir.h>
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <unistd.h>
 
 #include "dnsinfo.h"
 #include "dnsinfo_create.h"
 
 enum {
+       TOKEN_DOMAIN,
+       TOKEN_FLAGS,
+       TOKEN_INTERFACE,
        TOKEN_NAMESERVER,
+       TOKEN_OPTIONS,
        TOKEN_PORT,
-       TOKEN_DOMAIN,
        TOKEN_SEARCH,
        TOKEN_SEARCH_ORDER,
        TOKEN_SORTLIST,
        TOKEN_TIMEOUT,
-       TOKEN_OPTIONS,
        TOKEN_MAX
 };
 
@@ -57,14 +62,16 @@ static const struct {
        int             token;
        int             max_count;
 } tokens [] = {
+       { "domain",             TOKEN_DOMAIN,           1       },
+       { "flags",              TOKEN_FLAGS,            1       },
+       { "interface",          TOKEN_INTERFACE,        1       },
        { "nameserver",         TOKEN_NAMESERVER,       MAXNS   },
+       { "options",            TOKEN_OPTIONS,          1       },
        { "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       },
 };
 
 
@@ -313,9 +320,47 @@ _dnsinfo_flatfile_create_resolver(const char *dir, const char *path)
                }
 
                switch (token) {
-                       case TOKEN_DOMAIN:
-                               _dns_resolver_set_domain(&res, word);
+                       case TOKEN_DOMAIN: {
+                               size_t  len;
+
+                               len = strlen(word);
+                               while ((len > 0) && (word[len - 1] == '.')) {
+                                       // trim trailing '.'
+                                       word[--len] = '\0';
+                               }
+                               if (len > 0) {
+                                       _dns_resolver_set_domain(&res, word);
+                               }
                                break;
+                       }
+
+                       case TOKEN_FLAGS: {
+                               uint32_t        flags   = 0;
+
+                               while (word != NULL) {
+                                       if (word[0] != '\0') {
+                                               if (strcasecmp(word, "scoped") == 0) {
+                                                       flags |= DNS_RESOLVER_FLAGS_SCOPED;
+                                               }
+                                       }
+                                       word = strsep(&lineptr, sep);
+                               }
+
+                               if (flags != 0) {
+                                       _dns_resolver_set_flags(&res, flags);
+                               }
+                               break;
+                       }
+
+                       case TOKEN_INTERFACE: {
+                               unsigned int    if_index;
+
+                               if_index = if_nametoindex(word);
+                               if (if_index > 0) {
+                                       _dns_resolver_set_if_index(&res, if_index);
+                               }
+                               break;
+                       }
 
                        case TOKEN_NAMESERVER: {
                                struct sockaddr *sa;
@@ -328,6 +373,31 @@ _dnsinfo_flatfile_create_resolver(const char *dir, const char *path)
                                break;
                        }
 
+                       case TOKEN_OPTIONS: {
+                               char    *options        = NULL;
+
+                               while (word != NULL) {
+                                       if (word[0] != '\0') {
+                                               if (options == NULL) {
+                                                       options = malloc(len+1);
+                                                       if (options == NULL) break;
+
+                                                       strlcpy(options, word, len+1);
+                                               } else {
+                                                       strlcat(options, " ", len+1);
+                                                       strlcat(options, word, len+1);
+                                               }
+                                       }
+                                       word = strsep(&lineptr, sep);
+                               }
+
+                               if (options != NULL) {
+                                       _dns_resolver_set_options(&res, options);
+                                       free(options);
+                               }
+                               break;
+                       }
+
                        case TOKEN_PORT: {
                                long    number  = -1;
 
@@ -342,12 +412,30 @@ _dnsinfo_flatfile_create_resolver(const char *dir, const char *path)
 
                                // multiple search domains are supported
                                while ((word != NULL) && (n++ < MAXDNSRCH)) {
-                                       _dns_resolver_add_search(&res, word);
+                                       size_t  len;
+
+                                       len = strlen(word);
+                                       while ((len > 0) && (word[len - 1] == '.')) {
+                                               // trim trailing '.'
+                                               word[--len] = '\0';
+                                       }
+                                       if (len > 0) {
+                                               _dns_resolver_add_search(&res, word);
+                                       }
                                        word = strsep(&lineptr, sep);
                                }
                                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;
+                       }
+
                        case TOKEN_SORTLIST: {
                                int     n       = 0;
 
@@ -363,10 +451,6 @@ _dnsinfo_flatfile_create_resolver(const char *dir, const char *path)
                                break;
                        }
 
-                       case TOKEN_OPTIONS:
-                               _dns_resolver_set_options(&res, lineptr);
-                               break;
-
                        case TOKEN_TIMEOUT: {
                                long    number  = -1;
 
@@ -375,15 +459,6 @@ _dnsinfo_flatfile_create_resolver(const char *dir, const char *path)
                                _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);
@@ -442,7 +517,8 @@ _dnsinfo_flatfile_add_resolvers(dns_create_config_t *config)
 }
 
 
-#ifdef MAIN
+#ifdef MAIN
+#undef MAIN
 
 #include "dnsinfo_copy.c"
 
@@ -472,4 +548,5 @@ main(int argc, char **argv)
 
        return 0;
 }
+
 #endif
index 4d7c2dd93a3a7087be8c81697f2c0f124396ac77..f7b256f4c8d7e518299d4277bf91d1f1a7cb3bee 100644 (file)
@@ -33,6 +33,7 @@
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <servers/bootstrap.h>
+#include <bootstrap_priv.h>
 
 #include "dnsinfo_private.h"
 #include "shared_dns_info_types.h"
@@ -59,11 +60,23 @@ _dns_configuration_server_port()
                server_name = DNS_SERVER;
        }
 
+#ifdef BOOTSTRAP_PRIVILEGED_SERVER
+       status = bootstrap_look_up2(bootstrap_port,
+                                   server_name,
+                                   &server,
+                                   0,
+                                   BOOTSTRAP_PRIVILEGED_SERVER);
+#else  // BOOTSTRAP_PRIVILEGED_SERVER
        status = bootstrap_look_up(bootstrap_port, server_name, &server);
+#endif // BOOTSTRAP_PRIVILEGED_SERVER
+
        switch (status) {
                case BOOTSTRAP_SUCCESS :
                        /* service currently registered, "a good thing" (tm) */
                        break;
+               case BOOTSTRAP_NOT_PRIVILEGED :
+                       /* the service is not privileged */
+                       return MACH_PORT_NULL;
                case BOOTSTRAP_UNKNOWN_SERVICE :
                        /* service not currently registered, try again later */
                        return MACH_PORT_NULL;
index 52b885e302e22e1a2971ca341776386496474073..58128a8e05b745330ef3ac2d13d8ecc2da115015 100644 (file)
  * +-------------------------------------------------------------------+
  * | struct _dns_config_buf_t                                          |
  * +-+-------------+---------------------------------------------------+
- * | | config      | struct dns_config_t                              |
- * | |            +-+--------------+----------------------------------+
- * | |             | | n_resolver   | int32_t                          | <- # of name resolvers
- * | |            | +--------------+----------------------------------+
- * | |             | | resolver     | dns_resolver_t **                | <- not used during creation, filled
- * | |             | |              |                                  |    in with pointer to a list of
- * | |            | |              |                                  |    resolver configurations which be
- * | |            | |              |                                  |    established in the "padding"
- * | |            | +--------------+----------------------------------+
- * | |            | | ...          | ...                              |
- * | +-------------+-+--------------+----------------------------------+
+ * | | config      | struct dns_config_t                               |
+ * | |             +-+-------------------+-----------------------------+
+ * | |             | | n_resolver        | int32_t                     | <- # of name resolvers
+ * | |             | +-------------------+-----------------------------+
+ * | |             | | resolver          | dns_resolver_t **           | <- not used during creation, filled
+ * | |             | |                   |                             |    in with pointer to a list of
+ * | |             | |                   |                             |    resolver configurations that will
+ * | |             | |                   |                             |    be established in the "padding"
+ * | |             | +-------------------+-----------------------------+
+ * | |             | | n_scoped_resolver | int32_t                     | <- # of name scoped resolvers
+ * | |             | +-------------------+-----------------------------+
+ * | |             | | scoped_resolver   | dns_resolver_t **           | <- not used during creation, filled
+ * | |             | |                   |                             |    in with pointer to a list of scoped
+ * | |             | |                   |                             |    resolver configurations  that will
+ * | |             | |                   |                             |    be established in the "padding"
+ * | |             | +-------------------+-----------------------------+
+ * | |             | | ...               | ...                         |
+ * | +-------------+-+-------------------+-----------------------------+
  * | | n_attribute | uint32_t                                          | <- how many bytes of "attribute"
- * | |            |                                                   |    data is associated with the
- * | |            |                                                   |    configuration
+ * | |             |                                                   |    data is associated with the
+ * | |             |                                                   |    configuration
  * |-+-------------+---------------------------------------------------+
  * | | n_padding   | uint32_t                                          | <- how many additional bytes
- * | |            |                                                   |    for arrays (of pointers), ...
+ * | |             |                                                   |    for arrays (of pointers), ...
  * +-+-------------+---------------------------------------------------+
  * | struct dns_attribute_t                                            |
  * |-+-------------+---------------------------------------------------+
  * | | attribute   | struct _dns_resolver_buf_t                        | <- the attribute data (resolver configuration #1)
  * | |             +-+-------------+-----------------------------------+
  * | |             | | resolver    | struct dns_resolver_t             |
- * | |             | |            +--------------+--------------------+
- * | |             | |            | domain       | char *             | <- not used during creation,
- * | |             | |            |              |                    |    filled in with pointer to
- * | |             | |            |              |                    |    domain name in the "padding"
- * | |             | |            +--------------+--------------------+
- * | |             | |            | n_nameserver | int32_t            | <- # of name server addresses
- * | |             | |            +--------------+--------------------+
- * | |             | |            | nameserver   | struct sockaddr ** | <- not used during creation,
- * | |             | |            |              |                    |    filled in with pointer to
- * | |             | |            |              |                    |    a list of addresses which
- * | |             | |            |              |                    |    will be established in the
- * | |             | |            |              |                    |    "padding"
- * | |             | |            +--------------+--------------------+
- * | |             | |            | ...                               |
+ * | |             | |             +--------------+--------------------+
+ * | |             | |             | domain       | char *             | <- not used during creation,
+ * | |             | |             |              |                    |    filled in with pointer to
+ * | |             | |             |              |                    |    domain name in the "padding"
+ * | |             | |             +--------------+--------------------+
+ * | |             | |             | n_nameserver | int32_t            | <- # of name server addresses
+ * | |             | |             +--------------+--------------------+
+ * | |             | |             | nameserver   | struct sockaddr ** | <- not used during creation,
+ * | |             | |             |              |                    |    filled in with pointer to
+ * | |             | |             |              |                    |    a list of addresses which
+ * | |             | |             |              |                    |    will be established in the
+ * | |             | |             |              |                    |    "padding"
+ * | |             | |             +--------------+--------------------+
+ * | |             | |             | ...                               |
  * | |             +-+-------------+--------------+--------------------+
  * | |             | | n_attribute | uint32_t                          |
  * | |             +-+-------------+-----------------------------------+
  * | |             | | attribute   | struct dns_attribute_t            |
- * | |             | |            +-+-----------+---------------------+
- * | |             | |            | | type      | uint32_t            | <- type of attribute (e.g. RESOLVER_ATTRIBUTE_DOMAIN)
- * | |             | |            | +-----------+---------------------+
+ * | |             | |             +-+-----------+---------------------+
+ * | |             | |             | | type      | uint32_t            | <- type of attribute (e.g. RESOLVER_ATTRIBUTE_DOMAIN)
+ * | |             | |             | +-----------+---------------------+
  * | |             | |             | | length    | uint32_t            | <- length of the attribute
- * | |             | |            | +-----------+---------------------+
- * | |             | |            | | attribute |                     | <- the attribute data ("apple.com")
+ * | |             | |             | +-----------+---------------------+
+ * | |             | |             | | attribute |                     | <- the attribute data ("apple.com")
  * | |             +-+-------------+-------------+---------------------+
  * | |             | | attribute   | struct dns_attribute_t            |
- * | |             | |            +-+-----------+---------------------+
- * | |             | |            | | type      | uint32_t            | <- type of attribute (e.g. RESOLVER_ATTRIBUTE_ADDRESS)
- * | |             | |            | +-----------+---------------------+
+ * | |             | |             +-+-----------+---------------------+
+ * | |             | |             | | type      | uint32_t            | <- type of attribute (e.g. RESOLVER_ATTRIBUTE_ADDRESS)
+ * | |             | |             | +-----------+---------------------+
  * | |             | |             | | length    | uint32_t            | <- length of the attribute
- * | |             | |            | +-----------+---------------------+
- * | |             | |            | | attribute |                     | <- the attribute data ("struct sockaddr_in" #1)
+ * | |             | |             | +-----------+---------------------+
+ * | |             | |             | | attribute |                     | <- the attribute data ("struct sockaddr_in" #1)
  * | |             +---------------+-----------------------------------+
  * | |             | | attribute   | struct dns_attribute_t            |
- * | |             | |            +-+-----------+---------------------+
- * | |             | |            | | type      | uint32_t            | <- type of attribute (e.g. RESOLVER_ATTRIBUTE_ADDRESS)
- * | |             | |            | +-----------+---------------------+
+ * | |             | |             +-+-----------+---------------------+
+ * | |             | |             | | type      | uint32_t            | <- type of attribute (e.g. RESOLVER_ATTRIBUTE_ADDRESS)
+ * | |             | |             | +-----------+---------------------+
  * | |             | |             | | length    | uint32_t            | <- length of the attribute
- * | |             | |            | +-----------+---------------------+
- * | |             | |            | | attribute |                     | <- the attribute data ("struct sockaddr_in" #2)
+ * | |             | |             | +-----------+---------------------+
+ * | |             | |             | | attribute |                     | <- the attribute data ("struct sockaddr_in" #2)
  * | |             +---------------+-----------------------------------+
- * | |             | ...                                              |
+ * | |             | ...                                               |
  * +-+-------------+---------------------------------------------------+
- * | | attribute   | struct _dns_resolver_buf_t                               | <- the attribute data (resolver configuration #2)
+ * | | attribute   | struct _dns_resolver_buf_t                        | <- the attribute data (resolver configuration #2)
  * | |             +---------------+-----------------------------------+
- * | |             | ...                                              |
+ * | |             | ...                                               |
  * +---------------+---------------------------------------------------+
- * | | ...                                                            |
+ * | | ...                                                             |
  * +---------------+---------------------------------------------------+
  *
  * When the data is unpacked the "n_padding" additional bytes
 
 // configuration buffer attributes
 enum {
-       CONFIG_ATTRIBUTE_RESOLVER       = 1
+       CONFIG_ATTRIBUTE_RESOLVER       = 1,
+       CONFIG_ATTRIBUTE_SCOPED_RESOLVER,
 };
 
 
@@ -153,7 +161,9 @@ enum {
        RESOLVER_ATTRIBUTE_ADDRESS,
        RESOLVER_ATTRIBUTE_SEARCH,
        RESOLVER_ATTRIBUTE_SORTADDR,
-       RESOLVER_ATTRIBUTE_OPTIONS
+       RESOLVER_ATTRIBUTE_IF_INDEX,
+       RESOLVER_ATTRIBUTE_FLAGS,
+       RESOLVER_ATTRIBUTE_OPTIONS,
 };
 
 
index f5e5cb8e828c536c31480e192e95c0e0689906df..adc3d6a3805d6194b9f41ed1207364fba9d43080 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2004-2009 Apple Inc.
+# Copyright (c) 2004-2011 Apple Inc.
 #
 # get-mobility-info
 #
@@ -54,7 +54,10 @@ ps axlww                                             > ps                    2>&1
 #
 # network interface configuration
 #
-ifconfig -a -b                                         > ifconfig              2>&1
+ifconfig -a -L -b -m -r -v                             > ifconfig              2>&1
+if [ $? -ne 0 ]; then
+       ifconfig -a                                     > ifconfig              2>&1
+fi
 
 #
 # network route configuration
@@ -142,6 +145,7 @@ for f in                                                                            \
        /Library/Preferences/SystemConfiguration/preferences.plist                      \
        /Library/Preferences/com.apple.alf.plist                                        \
        /Library/Preferences/com.apple.sharing.firewall.plist                           \
+       /Library/Preferences/com.apple.wwand.plist                                      \
 
 do
        if [ -e "${f}" ]; then
@@ -150,6 +154,17 @@ do
        fi
 done
 
+#
+# InternetSharing
+#
+if   [ -e /etc/bootpd.plist ]; then
+       cat /etc/bootpd.plist                                                   > bootpd.plist                  2>&1
+       cat /etc/com.apple.named.proxy.conf                                     > com.apple.named.proxy.conf    2>&1
+elif [ -e /Library/Preferences/SystemConfiguration/bootpd.plist ]; then
+       cat /Library/Preferences/SystemConfiguration/bootpd.plist               > bootpd.plist                  2>&1
+       cat /Library/Preferences/SystemConfiguration/com.apple.named.proxy.conf > com.apple.named.proxy.conf    2>&1
+fi
+
 #
 # configd's cache
 #
@@ -158,19 +173,34 @@ open
 snapshot
 quit
 _END_OF_INPUT
-if [ -f /var/tmp/configd-store.xml ]; then
-       cat /var/tmp/configd-store.xml                  > configd-store.xml     2>&1
+if [ -f /var/tmp/configd-store.plist ]; then
+       cat /var/tmp/configd-store.plist                > configd-store.plist   2>&1
 fi
-if [ -f /var/tmp/configd-pattern.xml ]; then
-       cat /var/tmp/configd-pattern.xml                > configd-pattern.xml   2>&1
+if [ -f /var/tmp/configd-pattern.plist ]; then
+       cat /var/tmp/configd-pattern.plist              > configd-pattern.plist 2>&1
 fi
-if [ -f /var/tmp/configd-session.xml ]; then
-       cat /var/tmp/configd-session.xml                > configd-session.xml   2>&1
+if [ -f /var/tmp/configd-session.plist ]; then
+       cat /var/tmp/configd-session.plist              > configd-session.plist 2>&1
 fi
 if [ -f /var/tmp/configd-state ]; then
        cat /var/tmp/configd-state                      > configd-state         2>&1
 fi
 
+#
+# check configd's executable
+#
+if [ -x /usr/bin/codesign ]; then
+       echo  "#"                                                                       >> configd-state
+       echo  "# codesign --verbose --display --entitlements - /usr/libexec/configd"    >> configd-state
+       echo  "#"                                                                       >> configd-state
+       /usr/bin/codesign --verbose --display --entitlements - /usr/libexec/configd     >> configd-state 2>&1
+
+       echo  "#"                                                                       >> configd-state
+       echo  "# codesign --verbose --verify /usr/libexec/configd"                      >> configd-state
+       echo  "#"                                                                       >> configd-state
+       /usr/bin/codesign --verbose --verify /usr/libexec/configd                       >> configd-state 2>&1
+fi
+
 #
 # network reachability
 #
@@ -187,16 +217,39 @@ mount                                                     > mounted-filesystems   2>&1
 #
 # mDNSResponder info
 #
-if [ -f /var/run/mDNSResponder.pid ]; then
-       ${PRIV} kill -INFO `cat /var/run/mDNSResponder.pid`
+if [ -x /usr/bin/killall ]; then
+       ${PRIV} killall -INFO mDNSResponder
+
+       # and wait a short amount of time for mDNSResponder
+       # to actually log the requested information
+       sleep 15
+fi
+
+#
+# awacsd info
+#
+if [ -x /usr/sbin/awacsd -a -x /usr/bin/killall ]; then
+       ${PRIV} killall -INFO awacsd                                    2>/dev/null
+
+       # and wait a short amount of time for awacsd
+       # to actually log the requested information
+       sleep 1
 fi
 
 #
 # system log, kernel.log, early boot log messages
 #
 if [ -x /usr/bin/syslog ]; then
+       # save the recent activity
        ${PRIV} syslog | tail -n 25000                                  > syslog
+
+       # save just the "kernel" activity (in case some of the
+       # interesting/relevant message are before the messages
+       # captured above.
+       ${PRIV} syslog -k Facility kern | tail -n 25000                 > kernel
+
        if [ -d /var/log/DiagnosticMessages ]; then
+               # save any MessageTracer activity
                ${PRIV} syslog  -d /var/log/DiagnosticMessages  \
                                -F raw                          \
                                -T local                        \
@@ -276,13 +329,6 @@ echo "# netstat -n -a -A"                          >> network-statistics
 echo "#"                                               >> network-statistics
 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
 echo "#"                                               >> network-statistics
@@ -298,50 +344,66 @@ echo "# netstat -i -n -d"                         >> network-statistics
 echo "#"                                               >> network-statistics
 netstat -i -n -d                                       >> network-statistics   2>&1
 
-if [ -x /sbin/ipfw ]; then
+if [ -x /usr/sbin/ndp ]; then
        echo "#"                                        >> network-statistics
-       echo "# ipfw -at show"                          >> network-statistics
+       echo "# ndp -n -a"                              >> network-statistics
        echo "#"                                        >> network-statistics
-       ipfw -at show                                   >> network-statistics   2>&1
-fi
+       ndp -n -a                                       >> network-statistics   2>&1
 
-if [ -x /usr/sbin/appletalk ]; then
        echo "#"                                        >> network-statistics
-       echo "# appletalk -s"                           >> network-statistics
+       echo "# ndp -n -p"                              >> network-statistics
        echo "#"                                        >> network-statistics
-       appletalk -s                                    >> network-statistics   2>&1
-fi
+       ndp -n -p                                       >> network-statistics   2>&1
 
-#
-# system usage statistics
-#
-echo "#"                                               >  system-statistics
-echo "# uptime"                                                >> system-statistics
-echo "#"                                               >> system-statistics
-uptime                                                 >> system-statistics    2>&1
+       echo "#"                                        >> network-statistics
+       echo "# ndp -n -r"                              >> network-statistics
+       echo "#"                                        >> network-statistics
+       ndp -n -r                                       >> network-statistics   2>&1
+fi
 
-echo "#"                                               >> system-statistics
-echo "# sysctl -a"                                     >> system-statistics
-echo "#"                                               >> system-statistics
-sysctl -a                                              >> system-statistics    2>&1
+if [ -x /sbin/ipfw ]; then
+       echo "#"                                        >> network-statistics
+       echo "# ipfw -at show"                          >> network-statistics
+       echo "#"                                        >> network-statistics
+       ${PRIV} ipfw -at show                           >> network-statistics   2>&1
+fi
 
-echo "#"                                               >> system-statistics
-echo "# zprint"                                                >> system-statistics
-echo "#"                                               >> system-statistics
-zprint                                                 >> system-statistics    2>&1
+if [ -x /sbin/pfctl ]; then
+       echo "#"                                        >  pf
+       echo "# pfctl -s all"                           >> pf
+       echo "#"                                        >> pf
+       ${PRIV} pfctl -s all                            >> pf                   2>&1
+       echo "=============================="           >> pf
+       echo "#"                                        >> pf
+       echo "# pfctl -s References"                    >> pf
+       echo "#"                                        >> pf
+       ${PRIV} pfctl -s References                     >> pf                   2>&1
+       for ANCHOR in `pfctl -s Anchors 2>/dev/null`
+       do
+               echo "=============================="   >> pf
+               echo "#"                                >> pf
+               echo "# pfctl -a ${ANCHOR} -s all"      >> pf
+               echo "#"                                >> pf
+               ${PRIV} pfctl -a ${ANCHOR} -s all       >> pf                   2>&1
+       done
+fi
 
-echo "#"                                               >> system-statistics
-echo "# top -l5 -s2"                                   >> system-statistics
-echo "#"                                               >> system-statistics
-echo ""
-echo "Please wait, collecting statistics"
-echo ""
-top -s 2 -l 5                                          >> system-statistics    2>&1
+if [ -x /usr/sbin/lsof ]; then
+       echo "#"                                        >> network-statistics
+       echo "# lsof -i -U -n -P"                       >> network-statistics
+       echo "#"                                        >> network-statistics
+       ${PRIV} lsof -i -U -n -P                        >> network-statistics   2>&1
+fi
 
 #
 # DirectoryService info
 #
-if [ -x /usr/bin/dscacheutil ]; then
+if [ -x /usr/bin/odutil ]; then
+       echo "#"                                        >  od-info
+       echo "# odutil show all"                        >> od-info
+       echo "#"                                        >> od-info
+       ${PRIV} odutil show all                         >> od-info              2>&1
+elif [ -x /usr/bin/dscacheutil ]; then
        echo "#"                                        >  ds-info
        echo "# dscacheutil -configuration"             >> ds-info
        echo "#"                                        >> ds-info
@@ -419,44 +481,155 @@ fi
 #
 # BTMM configuration
 #
-DIG()
+
+BTMM_CLEANUP()
 {
-       /usr/bin/dig @pm-members.mac.com -y "${DOMAIN}:${TSIG}" +short "${1}" "${2}" 2>/dev/null
+       rm -f .btmmfifo .btmminfo .digsync
 }
 
-scutil <<_END_OF_INPUT                                 \
-| sed -n 's@.* : *\(.*\.members\.mac\.com\)$@\1@p'     \
-| sort                                                 \
-| while read DOMAIN
-open
-show Setup:/Network/BackToMyMac
-quit
-_END_OF_INPUT
-do
-       echo ""                                                 >> btmm
+BTMM_SETUP()
+{
+       BTMM_CLEANUP
+       mkfifo .btmmfifo
+
+       BTMMPORT=40000
+       while nc -6z ::1 "${PORT}"                      > /dev/null     2>&1
+       do
+               BTMMPORT=$((PORT + 1))
+       done
+}
+
+BTMM_CHECKMACDOTCOM()
+{
+       TAIL=`echo "${1}" | cut -d. -f2-`
+       if [ "${TAIL}" = "members.mac.com" ]; then
+               return 0
+       fi
+
+       return 1
+}
+
+# get DNS info
+# params: QUERYNAME QUERYTYPE
+BTMM_DIG()
+{
+       rm -f .digsync
+       
+       nc -6 -l "${BTMMPORT}" < .btmmfifo                      \
+       | openssl s_client      -connect "${HOSTPORT}" -quiet   > .btmmfifo     2>.digsync &
+       
+       N_RETRY=0
+       while [ $N_RETRY -lt 50 -a ! -s .digsync ]
+       do
+               N_RETRY=$((N_RETRY + 1))
+               sleep 0.1
+       done
+       
+       dig @::1        -p "${BTMMPORT}"                \
+                       -y "${TSIG}"                    \
+                       +short                          \
+                       +tcp                            \
+                       "${1}" "${2}"                   2>/dev/null
+       
+       wait %1
+}
+
+# get the unique identifier used to lookup the keychain item for a zone
+# params: ZONE
+BTMM_UNIQUEIDFROMZONE()
+{
+       BTMM_CHECKMACDOTCOM "${1}"
+       if [ $? -eq 0 ]; then
+               echo "dns:${1}"
+       else
+               echo "btmmdns:${1}"
+       fi
+}
+
+# get hostname, port, TSIG name and TSIG data from keychain 
+# params: UNIQUEID
+BTMM_GETINFO()
+{
+       ${PRIV} security find-generic-password          \
+               -s "${1}"                               \
+               -g /Library/Keychains/System.keychain   > .btmminfo     2>/dev/null
+       ${PRIV} security find-generic-password          \
+               -s "${1}"                               \
+               -g /Library/Keychains/System.keychain   \
+               2>&1                                    \
+       | sed -n 's/^password: \"\(.*\)\"$/\1/p'
+}
+
+# params: ZONE
+BTMM_URLISH()
+{
+       BTMM_CHECKMACDOTCOM "${1}"
+       if [ $? -eq 0 ]; then
+               echo "pm-members.mac.com.:443"
+       else
+               cat .btmminfo | sed -n 's/.*0x00000007 <blob>=\"\(.*\)\"/\1/p'
+       fi
+}
+
+BTMM_RELAYINFO()
+{
+       BTMM_CHECKMACDOTCOM "${1}"
+       if [ $? -eq 0 ]; then
+               return
+       fi
+       
+       SECRET=`BTMM_GETINFO "btmmrelay:${1}"`
+       
+       if [ -z "${SECRET}" ]; then
+               echo "  No Relay keychain item."                >> btmm
+               return
+       fi
+       
+       if [ `echo "${SECRET}" | wc -l` -ne 1 ]; then
+               echo "  More than one Relay keychain item."     >> btmm
+               return
+       fi
+       
+       URLISH=`BTMM_URLISH "${DOMAIN}"`
+       ACCOUNT=`cat .btmminfo | sed -n 's/.*\"acct\"<blob>=\"\(.*\)\"/\1/p'`
+       KEYHASH="[SHA-1:`echo ${SECRET} | openssl sha1`]"
+       echo "  RHP: ${URLISH}"                                 >> btmm
+       echo "  RAC: ${ACCOUNT}"                                >> btmm
+       echo "  RKY: ${KEYHASH}"                                >> btmm
+}
+
+BTMM_REPORTZONE()
+{
+       DOMAIN="${1}"
+       
+       echo                                                    >> btmm
        echo "${DOMAIN}"                                        >> btmm
+       
+       DNSID=`BTMM_UNIQUEIDFROMZONE "${DOMAIN}"`
+       SECRET=`BTMM_GETINFO "${DNSID}"`
 
-       # lookup TSIG in base64 format
-       TSIG=`                                                          \
-               ${PRIV} security find-generic-password                  \
-                       -s dns:${DOMAIN}                                \
-                       -g /Library/Keychains/System.keychain 2>&1      \
-               | grep "^password: "                                    \
-               | cut -d '"' -f 2                                       \
-               | cut -d '\' -f 1                                       \
-            `
-       if [ -z "$TSIG" ]; then
-               echo "  No TSIG in system keychain."            >> btmm
-               continue
+       if [ -z "${SECRET}" ]; then
+               echo "  No DNS keychain item."                  >> btmm
+               return
        fi
-       if [ `echo "$TSIG" | wc -l` -ne 1 ] ; then
-               echo "  More than one TSIG in system keychain." >> btmm
-               continue
+       
+       if [ `echo "${SECRET}" | wc -l` -ne 1 ]; then
+               echo "  More than one DNS keychain item."       >> btmm
+               return
        fi
+       
+       URLISH=`BTMM_URLISH "${DOMAIN}"`
+       HOSTPORT=`echo "${URLISH}" | cut -d@ -f2`
+       ACCOUNT=`cat .btmminfo | sed -n 's/.*\"acct\"<blob>=\"\(.*\)\"/\1/p'`
+       TSIG="${ACCOUNT}:${SECRET}"
 
-       KEYHASH="[SHA-1:`echo ${TSIG} | openssl sha1`]"
+       KEYHASH="[SHA-1:`echo ${SECRET} | openssl sha1`]"
        echo ""                                                 >> btmm
-       echo "  KEY: ${KEYHASH}"                                >> btmm
+       echo "  DHP: ${URLISH}"                                 >> btmm
+       echo "  DAC: ${ACCOUNT}"                                >> btmm
+       echo "  DKY: ${KEYHASH}"                                >> btmm
+       
+       BTMM_RELAYINFO "${DOMAIN}"
 
        for TYPE in                     \
                _afpovertcp._tcp        \
@@ -467,7 +640,7 @@ do
                _smb._tcp               \
                _ssh._tcp
        do
-               DIG "${TYPE}.${DOMAIN}" ptr     \
+               BTMM_DIG "${TYPE}.${DOMAIN}" ptr        \
                | while read -r REG
                do
                        echo ""                                 >> btmm
@@ -475,10 +648,10 @@ do
                        echo ""                                 >> btmm
 
                        INF_Q=`/bin/echo "${REG}" | sed -e "s/${TYPE}/_device-info._tcp/"`
-                       INF=`DIG "${INF_Q}" txt`
+                       INF=`BTMM_DIG "${INF_Q}" txt`
                        echo "    INF: ${INF}"                  >> btmm
 
-                       SRV=`DIG ${REG} srv`
+                       SRV=`BTMM_DIG ${REG} srv`
                        SRV1=`/bin/echo "${SRV}" | head -1`
                        echo "    SRV: ${SRV1}"                 >> btmm
                        SRV2=`/bin/echo "${SRV}" | tail +2`
@@ -488,7 +661,7 @@ do
                                | sed -e 's/^/  *****: /'       >> btmm
                        fi
 
-                       TXT=`DIG ${REG} txt`
+                       TXT=`BTMM_DIG ${REG} txt`
                        TXT1=`/bin/echo "${TXT}" | head -1`
                        echo "    TXT: ${TXT1}"                 >> btmm
                        TXT2=`/bin/echo "${TXT}" | tail +2`
@@ -499,11 +672,11 @@ do
 
                        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`
-                               AT6=`DIG _autotunnel6.${HOST} aaaa`
+                               V4=`BTMM_DIG ${HOST} a`
+                               V6=`BTMM_DIG ${HOST} aaaa`
+                               KRB=`BTMM_DIG _kerberos.${HOST} txt`
+                               TUN=`BTMM_DIG _autotunnel._udp.${HOST} srv`
+                               AT6=`BTMM_DIG _autotunnel6.${HOST} aaaa`
                        else
                                V4=""
                                V6=""
@@ -525,8 +698,8 @@ do
 
                                HOST=`/bin/echo "${TUN}" | cut -d ' ' -f 4-`
                                if [ -n "${HOST}" ]; then
-                                       V4=`DIG ${HOST} a`
-                                       V6=`DIG ${HOST} aaaa`
+                                       V4=`BTMM_DIG ${HOST} a`
+                                       V6=`BTMM_DIG ${HOST} aaaa`
                                fi
                                if [ -n "${V4}" ]; then
                                        echo "     v4: ${V4}"   >> btmm
@@ -540,8 +713,24 @@ do
                        fi
                done
        done
+}
+
+BTMM_SETUP
+
+scutil <<_END_OF_INPUT \
+| sed -n 's@.* : *\(.*\)$@\1@p' \
+| sort \
+| while read DOMAIN
+open
+show Setup:/Network/BackToMyMac
+quit
+_END_OF_INPUT
+do
+       BTMM_REPORTZONE "$DOMAIN"
 done
 
+BTMM_CLEANUP
+
 #
 # collect crash reports
 #
@@ -551,6 +740,7 @@ for daemon in                               \
                eapolclient             \
                mDNSResponder           \
                mDNSResponderHelper     \
+               awacsd                  \
                pppd                    \
                racoon                  \
                socketfilterfw          \
@@ -558,21 +748,53 @@ for daemon in                             \
                SCMonitor               \
 
 do
-       /bin/ls -1      /Library/Logs/CrashReporter/${daemon}_*.crash           \
-                       /Library/Logs/DiagnosticReports/${daemon}/*.crash       \
+       /bin/ls -1      /Library/Logs/DiagnosticReports/${daemon}_*.crash       \
+                       /Library/Logs/CrashReporter/${daemon}_*.crash           \
                        2>/dev/null                                             \
        | while read log
        do
-               b="`basename ${log}`"
-               ${PRIV} cat "${log}"                    > "${b}"                2>&1
+               if [ -f "${log}" ]; then
+                       b="`basename ${log}`"
+                       ${PRIV} cat "${log}"            > "${b}"                2>&1
+               fi
        done
 done
 
+#
+# system usage statistics
+#
+echo "#"                                               >  system-statistics
+echo "# uptime"                                                >> system-statistics
+echo "#"                                               >> system-statistics
+uptime                                                 >> system-statistics    2>&1
+
+echo "#"                                               >> system-statistics
+echo "# sysctl -a"                                     >> system-statistics
+echo "#"                                               >> system-statistics
+sysctl -a                                              >> system-statistics    2>&1
+
+echo "#"                                               >> system-statistics
+echo "# zprint"                                                >> system-statistics
+echo "#"                                               >> system-statistics
+zprint                                                 >> system-statistics    2>&1
+
+echo "#"                                               >> system-statistics
+echo "# top -l5 -s2"                                   >> system-statistics
+echo "#"                                               >> system-statistics
+echo ""
+echo "Please wait, collecting statistics"
+echo ""
+top -s 2 -l 5                                          >> system-statistics    2>&1
+
 #
 # collect everything into a single archive
 #
 cd "${WORKDIR}/.."
-pax -w ${GZ_OPT} -f "${ARCHIVE}" "${OUT}"
+if [ -x /usr/bin/tar ]; then
+       tar -c ${GZ_OPT} -f "${ARCHIVE}" "${OUT}"
+else
+       pax -w ${GZ_OPT} -f "${ARCHIVE}" "${OUT}"
+fi
 rm -rf "${WORKDIR}"
 
 if [ ${UID} -eq 0 ]; then
index 5c42fb3780f65fd6608598e634f86e0a5c4b3e21..7a89d377b183763dfb059ecd73a7fffd8c6f8d60 100644 (file)
@@ -291,10 +291,11 @@ main(int argc, char **argv)
        }
 
        if (argc == 1) {
-               SCPrint(TRUE, stderr, CFSTR("Set \"%@\" not available.\n\n"), newSet);
+               SCPrint(TRUE, stderr, CFSTR("Set \"%@\" not available.\n"), newSet);
+               exit(1);
        }
 
-       SCPrint(TRUE, stderr,
+       SCPrint(TRUE, stdout,
                CFSTR("Defined sets include:%s\n"),
                (currentMatched > 0) ? " (* == current set)" : "");
 
@@ -303,7 +304,7 @@ main(int argc, char **argv)
                CFDictionaryRef dict = (CFDictionaryRef)setVals[i];
                CFStringRef     udn  = CFDictionaryGetValue(dict, kSCPropUserDefinedName);
 
-               SCPrint(TRUE, stderr,
+               SCPrint(TRUE, stdout,
                        CFSTR(" %s %@\t(%@)\n"),
                        ((currentMatched > 0) && CFEqual(key, current)) ? "*" : " ",
                        key,
@@ -312,19 +313,19 @@ main(int argc, char **argv)
 
        switch (currentMatched) {
                case -2 :
-                       SCPrint(TRUE, stderr, CFSTR("\nCurrentSet not defined.\n"));
+                       SCPrint(TRUE, stdout, CFSTR("\nCurrent set not defined.\n"));
                        break;
                case -1 :
-                       SCPrint(TRUE, stderr, CFSTR("\nCurrentSet \"%@\" may not be valid\n"), current);
+                       SCPrint(TRUE, stdout, CFSTR("\nCurrent set \"%@\" may not be valid\n"), current);
                        break;
                case  0 :
-                       SCPrint(TRUE, stderr, CFSTR("\nCurrentSet \"%@\" not valid\n"), current);
+                       SCPrint(TRUE, stdout, CFSTR("\nCurrent set \"%@\" not valid\n"), current);
                        break;
                default :
                        break;
        }
 
-       exit (1);
+       exit (0);
 
     found :
 
index c7c8d70ae3583dc85606aa7cbdb1eff6caa70bcd..59d929d0aeb355eedd3e0ee2d329913da654b8cf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -210,7 +210,7 @@ const cmdInfo commands_net[] = {
                " remove set       [ <setName> | <set#> ]"                                      },
 
        { "select",     2,      3,      do_net_select,          7,      0,
-               " select interface <interfaceName> | <interface#> | $child | $service | $vlan | $bond <memberName>\n"
+               " select interface <interfaceName> | <interface#> | $child | $service | $vlan | $bond <memberName> | $bridge <memberName>\n"
                " select protocol  <protocolType>\n"
                " select service   <serviceName> | <service#>\n"
                " select set       <setName> | <set#>"                                          },
@@ -219,7 +219,7 @@ const cmdInfo commands_net[] = {
                " set interface context-sensitive-arguments (or ? for help)\n"
                " set protocol  context-sensitive-arguments (or ? for help)\n"
                " set service   [ name <serviceName> ] [ order new-order ] [ rank ("" | First | Last | Never) [temp] ]\n"
-               " set set       [ name setName ]"                                               },
+               " set set       [ name setName ] | [ current ]"                                 },
 
        { "show",       1,      2,      do_net_show,            9,      0,
                " show interfaces\n"
@@ -396,6 +396,7 @@ do_readFile(int argc, char **argv)
        /* allocate command input stream */
        src = (InputRef)CFAllocatorAllocate(NULL, sizeof(Input), 0);
        src->el = NULL;
+       src->h  = NULL;
        src->fp = fopen(argv[0], "r");
 
        if (src->fp == NULL) {
index 032c59109c71c7c171916ddeeb57c4ac374cad82..396e3ab5add00be21c4ce3d29dfe77a86d9a4b7d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2009, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -176,7 +176,7 @@ do_dictSetKey(int argc, char **argv)
        if (doArray) {
                CFDictionarySetValue(newValue, key, array);
                CFRelease(array);
-       } else {
+       } else if (val != NULL) {
                CFDictionarySetValue(newValue, key, val);
                CFRelease(val);
        }
diff --git a/scutil.tproj/nc.c b/scutil.tproj/nc.c
new file mode 100644 (file)
index 0000000..48806d0
--- /dev/null
@@ -0,0 +1,772 @@
+/*
+ * Copyright (c) 2010-2011 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
+ *
+ * March 1, 2010                       Christophe Allie <callie@apple.com>
+ * - initial revision
+ * February 8, 2011                    Kevin Wells <kcw@apple.com>
+ * - added "select" command
+ */
+
+
+#include "scutil.h"
+#include "nc.h"
+#include "prefs.h"
+
+#include <sys/time.h>
+
+
+static SCNetworkConnectionRef  connectionRef   = NULL;
+static int                     n_callback      = 0;
+
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static void
+my_CFRelease(void *t)
+{
+       void * * obj = (void * *)t;
+       if (obj && *obj) {
+               CFRelease(*obj);
+               *obj = NULL;
+       }
+       return;
+}
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static CFStringRef
+nc_copy_serviceID(int argc, char **argv)
+{
+       CFStringRef             serviceIDRef    = NULL;
+
+       if (argc == 0) {
+               serviceIDRef = _copyStringFromSTDIN();
+       } else {
+               serviceIDRef = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+       }
+
+       return serviceIDRef;
+}
+
+/* -----------------------------------------------------------------------------
+ ----------------------------------------------------------------------------- */
+static SCNetworkServiceRef
+nc_copy_service(SCNetworkSetRef set, CFStringRef identifier)
+{
+       CFIndex                 i;
+       CFIndex                 n;
+       SCNetworkServiceRef     selected        = NULL;
+       CFArrayRef              services;
+
+       services = SCNetworkConnectionCopyAvailableServices(set);
+       if (services == NULL) {
+               goto done;
+       }
+
+       n = CFArrayGetCount(services);
+
+       // try to select the service by its serviceID
+       for (i = 0; i < n; i++) {
+               SCNetworkServiceRef     service         = NULL;
+               CFStringRef             serviceID;
+
+               service = CFArrayGetValueAtIndex(services, i);
+               serviceID = SCNetworkServiceGetServiceID(service);
+               if (CFEqual(identifier, serviceID)) {
+                       selected = service;
+                       goto done;
+               }
+       }
+
+       // try to select the service by service name
+       for (i = 0; i < n; i++) {
+               SCNetworkServiceRef     service         = NULL;
+               CFStringRef             serviceName;
+
+               service = CFArrayGetValueAtIndex(services, i);
+               serviceName = SCNetworkServiceGetName(service);
+               if ((serviceName != NULL) && CFEqual(identifier, serviceName)) {
+                       if (selected == NULL) {
+                               selected = service;
+                       } else {
+                               // if multiple services match
+                               selected = NULL;
+                               SCPrint(TRUE, stdout, CFSTR("multiple services match\n"));
+                               goto done;
+                       }
+               }
+       }
+
+    done :
+
+       if (selected != NULL) CFRetain(selected);
+       if (services != NULL) CFRelease(services);
+       return selected;
+}
+
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static char *
+nc_status_string(SCNetworkConnectionStatus status)
+{
+       switch (status) {
+               case kSCNetworkConnectionInvalid:
+                       return "Invalid";
+               case kSCNetworkConnectionDisconnected:
+                       return "Disconnected";
+               case kSCNetworkConnectionConnecting:
+                       return "Connecting";
+               case kSCNetworkConnectionConnected:
+                       return "Connected";
+               case kSCNetworkConnectionDisconnecting:
+                       return "Disconnecting";
+       }
+       return "Unknown";
+}
+
+static void
+nc_callback(SCNetworkConnectionRef connection, SCNetworkConnectionStatus status, void *info)
+{
+       int             *n              = (int *)info;
+       CFDictionaryRef status_dict;
+
+       // report status
+       if (n != NULL) {
+               if (*n == 0) {
+                       SCPrint(TRUE, stdout, CFSTR("Current status = "));
+               } else {
+                       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("Callback (%d) status = "), *n);
+               }
+               *n = *n + 1;
+       }
+       SCPrint(TRUE, stdout, CFSTR("%s%s%s\n"),
+               nc_status_string(status),
+               (status == kSCNetworkConnectionInvalid) ? ": "                     : "",
+               (status == kSCNetworkConnectionInvalid) ? SCErrorString(SCError()) : "");
+
+       // report extended status
+       status_dict = SCNetworkConnectionCopyExtendedStatus(connection);
+       if (status_dict) {
+               SCPrint(TRUE, stdout, CFSTR("Extended Status %@\n"), status_dict);
+               CFRelease(status_dict);
+       }
+
+       return;
+}
+
+static void
+nc_create_connection(int argc, char **argv, Boolean exit_on_failure)
+{
+       SCNetworkConnectionContext      context = { 0, &n_callback, NULL, NULL, NULL };
+       SCNetworkServiceRef             service;
+       CFStringRef                     serviceIDRef;
+
+       serviceIDRef = nc_copy_serviceID(argc, argv);
+       if (serviceIDRef == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("No service identifier\n"));
+               if (exit_on_failure)
+                       exit(1);
+               return;
+       }
+
+       service = nc_copy_service(NULL, serviceIDRef);
+       CFRelease(serviceIDRef);
+       if (service == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("No service\n"));
+               if (exit_on_failure)
+                       exit(1);
+               return;
+       }
+
+       connectionRef = SCNetworkConnectionCreateWithService(NULL, service, nc_callback, &context);
+       if (connectionRef == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("nc_create_connection SCNetworkConnectionCreateWithServiceID() failed to create connectionRef: %s\n"), SCErrorString(SCError()));
+               if (exit_on_failure)
+                       exit(1);
+               return;
+       }
+}
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static void
+nc_release_connection()
+{
+       my_CFRelease(&connectionRef);
+}
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static void
+nc_start(int argc, char **argv)
+{
+       nc_create_connection(argc, argv, TRUE);
+
+       SCNetworkConnectionStart(connectionRef, 0, TRUE);
+
+       nc_release_connection();
+       exit(0);
+}
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static void
+nc_stop(int argc, char **argv)
+{
+       nc_create_connection(argc, argv, TRUE);
+
+       SCNetworkConnectionStop(connectionRef, TRUE);
+
+       nc_release_connection();
+       exit(0);
+}
+
+/* -----------------------------------------------------------------------------
+ ----------------------------------------------------------------------------- */
+static void
+nc_suspend(int argc, char **argv)
+{
+       nc_create_connection(argc, argv, TRUE);
+
+       SCNetworkConnectionSuspend(connectionRef);
+
+       nc_release_connection();
+       exit(0);
+}
+
+/* -----------------------------------------------------------------------------
+ ----------------------------------------------------------------------------- */
+static void
+nc_resume(int argc, char **argv)
+{
+       nc_create_connection(argc, argv, TRUE);
+
+       SCNetworkConnectionResume(connectionRef);
+
+       nc_release_connection();
+       exit(0);
+}
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static void
+nc_status(int argc, char **argv)
+{
+       SCNetworkConnectionStatus       status;
+
+       nc_create_connection(argc, argv, TRUE);
+
+       status = SCNetworkConnectionGetStatus(connectionRef);
+       nc_callback(connectionRef, status, NULL);
+
+       nc_release_connection();
+       exit(0);
+}
+
+static void
+nc_watch(int argc, char **argv)
+{
+       SCNetworkConnectionStatus       status;
+
+       nc_create_connection(argc, argv, TRUE);
+
+       status = SCNetworkConnectionGetStatus(connectionRef);
+
+       // report initial status
+       n_callback = 0;
+       nc_callback(connectionRef, status, &n_callback);
+
+       // setup watcher
+       if (doDispatch) {
+               if (!SCNetworkConnectionSetDispatchQueue(connectionRef, dispatch_get_current_queue())) {
+                       printf("SCNetworkConnectionSetDispatchQueue() failed: %s\n", SCErrorString(SCError()));
+                       exit(1);
+               }
+       } else {
+               if (!SCNetworkConnectionScheduleWithRunLoop(connectionRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
+                       printf("SCNetworkConnectinScheduleWithRunLoop() failed: %s\n", SCErrorString(SCError()));
+                       exit(1);
+               }
+       }
+
+       // wait for changes
+       CFRunLoopRun();
+
+       nc_release_connection();
+       exit(0);
+}
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static void
+nc_statistics(int argc, char **argv)
+{
+       CFDictionaryRef stats_dict;
+
+       nc_create_connection(argc, argv, TRUE);
+
+       stats_dict = SCNetworkConnectionCopyStatistics(connectionRef);
+
+       if (stats_dict) {
+               SCPrint(TRUE, stdout, CFSTR("%@\n"), stats_dict);
+       } else {
+               SCPrint(TRUE, stdout, CFSTR("No statistics available\n"));
+       }
+
+       my_CFRelease(&stats_dict);
+
+       nc_release_connection();
+       exit(0);
+}
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static void
+nc_ondemand(int argc, char **argv)
+{
+       int                     exit_code       = 1;
+       CFStringRef             key             = NULL;
+       CFDictionaryRef         ondemand_dict   = NULL;
+       SCDynamicStoreRef       store;
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("scutil --nc"), NULL, NULL);
+       if (store == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("do_nc_ondemand SCDynamicStoreCreate() failed: %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetOnDemand);
+       if (key == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("do_nc_ondemand SCDynamicStoreKeyCreateNetworkGlobalEntity() failed: %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+
+       ondemand_dict = SCDynamicStoreCopyValue(store, key);
+       if (ondemand_dict) {
+               SCPrint(TRUE, stdout, CFSTR("%@ %@\n"), kSCEntNetOnDemand, ondemand_dict);
+       } else {
+               SCPrint(TRUE, stdout, CFSTR("%@ not configured\n"), kSCEntNetOnDemand);
+       }
+
+       exit_code = 0;
+done:
+       my_CFRelease(&ondemand_dict);
+       my_CFRelease(&key);
+       my_CFRelease(&store);
+       exit(exit_code);
+}
+
+/* -----------------------------------------------------------------------------
+ Given a string 'key' and a string prefix 'prefix',
+ return the next component in the slash '/' separated
+ key.  If no slash follows the prefix, return NULL.
+
+ Examples:
+ 1. key = "a/b/c" prefix = "a/"    returns "b"
+ 2. key = "a/b/c" prefix = "a/b/"  returns NULL
+----------------------------------------------------------------------------- */
+CFStringRef parse_component(CFStringRef key, CFStringRef prefix)
+{
+       CFMutableStringRef      comp;
+       CFRange                 range;
+
+       if (!CFStringHasPrefix(key, prefix))
+               return NULL;
+
+       comp = CFStringCreateMutableCopy(NULL, 0, key);
+       CFStringDelete(comp, CFRangeMake(0, CFStringGetLength(prefix)));
+       range = CFStringFind(comp, CFSTR("/"), 0);
+       if (range.location == kCFNotFound) {
+               CFRelease(comp);
+               return NULL;
+       }
+       range.length = CFStringGetLength(comp) - range.location;
+       CFStringDelete(comp, range);
+       return comp;
+}
+
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static void
+nc_list(int argc, char **argv)
+{
+       int                     count;
+       int                     exit_code       = 1;
+       int                     i;
+       CFStringRef             key             = NULL;
+       CFMutableDictionaryRef  names           = NULL;
+       CFArrayRef              services        = NULL;
+       CFStringRef             setup           = NULL;
+       SCDynamicStoreRef       store;
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("scutil --nc"), NULL, NULL);
+       if (store == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("nc_list SCDynamicStoreCreate() failed: %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+       key = SCDynamicStoreKeyCreateNetworkServiceEntity(0, kSCDynamicStoreDomainSetup, kSCCompAnyRegex, kSCEntNetInterface);
+       if (key == NULL ) {
+               SCPrint(TRUE, stderr, CFSTR("nc_list SCDynamicStoreKeyCreateNetworkServiceEntity() failed to create key string\n"));
+               goto done;
+       }
+       setup = SCDynamicStoreKeyCreate(0, CFSTR("%@/%@/%@/"), kSCDynamicStoreDomainSetup, kSCCompNetwork, kSCCompService);
+       if (setup == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("nc_list SCDynamicStoreKeyCreate() failed to create setup string\n"));
+               goto done;
+       }
+       names = CFDictionaryCreateMutable(NULL,
+                                         0,
+                                         &kCFTypeDictionaryKeyCallBacks,
+                                         &kCFTypeDictionaryValueCallBacks);
+       if (names == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("nc_list CFDictionaryCreateMutable() failed to create names dictionary\n"));
+               goto done;
+       }
+       services = SCNetworkConnectionCopyAvailableServices(NULL);
+       if (services != NULL) {
+               count = CFArrayGetCount(services);
+
+               for (i = 0; i < count; i++) {
+                       SCNetworkServiceRef     service;
+                       CFStringRef             serviceID;
+                       CFStringRef             serviceName;
+
+                       service = CFArrayGetValueAtIndex(services, i);
+                       serviceID = SCNetworkServiceGetServiceID(service);
+                       serviceName = SCNetworkServiceGetName(service);
+                       if (serviceName != NULL) {
+                               CFDictionarySetValue(names, serviceID, serviceName);
+                       }
+               }
+
+               CFRelease(services);
+       }
+
+       services = SCDynamicStoreCopyKeyList(store, key);
+       if (services == NULL ) {
+               SCPrint(TRUE, stderr, CFSTR("nc_list SCDynamicStoreCopyKeyList() failed: %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+
+       count = CFArrayGetCount(services);
+       for (i = 0; i < count; i++) {
+               CFStringRef serviceID;
+
+               serviceID = parse_component(CFArrayGetValueAtIndex(services, i), setup);
+               if (serviceID) {
+                       CFStringRef     iftype;
+                       CFStringRef     ifsubtype;
+                       CFStringRef     interface_key   = NULL;
+                       CFDictionaryRef interface_dict  = NULL;
+                       CFStringRef     service_name;
+
+                       interface_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainSetup, serviceID, kSCEntNetInterface);
+                       if (!interface_key)  {
+                               SCPrint(TRUE, stderr, CFSTR("nc_list SCDynamicStoreKeyCreateNetworkServiceEntity() failed to interface key string\n"));
+                               goto endloop;
+                       }
+
+                       interface_dict = SCDynamicStoreCopyValue(store, interface_key);
+                       if (!interface_dict) {
+                               SCPrint(TRUE, stderr, CFSTR("nc_list SCDynamicStoreCopyValue() to copy interface dictionary: %s\n"), SCErrorString(SCError()));
+                               goto endloop;
+                       }
+
+                       iftype = CFDictionaryGetValue(interface_dict, kSCPropNetInterfaceType);
+                       if (!iftype) {
+                               // is that an error condition ???
+                               goto endloop;
+                       }
+
+                       if (!CFEqual(iftype, kSCEntNetPPP) &&
+                               !CFEqual(iftype, kSCEntNetIPSec) &&
+                               !CFEqual(iftype, kSCEntNetVPN))
+                               goto endloop;
+
+                       ifsubtype = CFDictionaryGetValue(interface_dict, kSCPropNetInterfaceSubType);
+
+                       service_name = CFDictionaryGetValue(names, serviceID);
+
+                       SCPrint(TRUE, stdout, CFSTR("[%@%@%@] %@%s%@\n"),
+                               iftype ? iftype : CFSTR("?"),
+                               ifsubtype ? CFSTR("/") : CFSTR(""),
+                               ifsubtype ? ifsubtype : CFSTR(""),
+                               serviceID,
+                               service_name ? " : " : "",
+                               service_name ? service_name : CFSTR(""));
+
+                   endloop:
+                       my_CFRelease(&interface_key);
+                       my_CFRelease(&interface_dict);
+                       my_CFRelease(&serviceID);
+               }
+       }
+
+       exit_code = 0;
+done:
+       my_CFRelease(&services);
+       my_CFRelease(&names);
+       my_CFRelease(&setup);
+       my_CFRelease(&key);
+       my_CFRelease(&store);
+       exit(exit_code);
+}
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+static void
+nc_show(int argc, char **argv)
+{
+       SCDynamicStoreRef       store = NULL;
+       int                     exit_code = 1;
+       CFStringRef             setup = NULL;
+       CFStringRef             serviceIDRef = NULL;
+       CFArrayRef              services = NULL;
+       CFStringRef             iftype = NULL;
+       CFStringRef             ifsubtype = NULL;
+       CFStringRef             interface_key = NULL;
+       CFDictionaryRef         interface_dict = NULL;
+       CFStringRef             type_entity_key = NULL;
+       CFStringRef             subtype_entity_key = NULL;
+       CFDictionaryRef         type_entity_dict = NULL;
+       CFDictionaryRef         subtype_entity_dict = NULL;
+
+       serviceIDRef = nc_copy_serviceID(argc, argv);
+       if (serviceIDRef == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("No service ID\n"));
+               goto done;
+       }
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("scutil --nc"), NULL, NULL);
+       if (store == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("nc_show SCDynamicStoreCreate() failed: %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+
+       interface_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainSetup, serviceIDRef, kSCEntNetInterface);
+       if (!interface_key) {
+               SCPrint(TRUE, stderr, CFSTR("nc_show SCDynamicStoreKeyCreateNetworkServiceEntity() failed to create interface key\n"));
+               goto done;
+       }
+
+       interface_dict = SCDynamicStoreCopyValue(store, interface_key);
+       if (!interface_dict) {
+               SCPrint(TRUE, stdout, CFSTR("Interface dictionary missing for service ID : %@\n"), serviceIDRef);
+               goto done;
+       }
+
+       iftype = CFDictionaryGetValue(interface_dict, kSCPropNetInterfaceType);
+       if (!iftype) {
+               SCPrint(TRUE, stdout, CFSTR("Interface Type missing for service ID : %@\n"), serviceIDRef);
+               goto done;
+       }
+
+       if (!CFEqual(iftype, kSCEntNetPPP) &&
+               !CFEqual(iftype, kSCEntNetIPSec) &&
+               !CFEqual(iftype, kSCEntNetVPN)) {
+               SCPrint(TRUE, stdout, CFSTR("Interface Type [%@] invalid for service ID : %@\n"), iftype, serviceIDRef);
+               goto done;
+       }
+
+       ifsubtype = CFDictionaryGetValue(interface_dict, kSCPropNetInterfaceSubType);
+       SCPrint(TRUE, stdout, CFSTR("[%@%@%@] %@\n"),
+               iftype ? iftype : CFSTR("?"),
+               ifsubtype ? CFSTR("/") : CFSTR(""),
+               ifsubtype ? ifsubtype : CFSTR(""),
+               serviceIDRef);
+
+       type_entity_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainSetup, serviceIDRef, iftype);
+       if (!type_entity_key) {
+               SCPrint(TRUE, stderr, CFSTR("nc_show SCDynamicStoreKeyCreateNetworkServiceEntity() failed to create type entity key\n"));
+               goto done;
+       }
+       type_entity_dict = SCDynamicStoreCopyValue(store, type_entity_key);
+       if (!type_entity_dict) {
+               SCPrint(TRUE, stdout, CFSTR("%@ dictionary missing for service ID : %@\n"), iftype, serviceIDRef);
+       } else {
+               SCPrint(TRUE, stdout, CFSTR("%@ %@\n"), iftype, type_entity_dict);
+       }
+
+       if (ifsubtype) {
+               subtype_entity_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainSetup, serviceIDRef, ifsubtype);
+               if (!subtype_entity_key) {
+                       SCPrint(TRUE, stderr, CFSTR("nc_show SCDynamicStoreKeyCreateNetworkServiceEntity() failed to create subtype entity key\n"));
+                       goto done;
+               }
+               subtype_entity_dict = SCDynamicStoreCopyValue(store, subtype_entity_key);
+               if (!subtype_entity_dict) {
+                       //
+               }
+               else {
+                       SCPrint(TRUE, stdout, CFSTR("%@ %@\n"), ifsubtype, subtype_entity_dict);
+               }
+       }
+
+       exit_code = 0;
+
+done:
+       my_CFRelease(&serviceIDRef);
+       my_CFRelease(&interface_key);
+       my_CFRelease(&interface_dict);
+       my_CFRelease(&type_entity_key);
+       my_CFRelease(&type_entity_dict);
+       my_CFRelease(&subtype_entity_key);
+       my_CFRelease(&subtype_entity_dict);
+       my_CFRelease(&services);
+       my_CFRelease(&setup);
+       my_CFRelease(&store);
+
+       exit(exit_code);
+}
+
+/* -----------------------------------------------------------------------------
+ ----------------------------------------------------------------------------- */
+static void
+nc_select(int argc, char **argv)
+{
+       SCNetworkSetRef         current_set;
+       int                     exit_code       = 1;
+       SCNetworkServiceRef     service         = NULL;
+       CFStringRef             service_id;
+       Boolean                 status;
+
+       service_id = nc_copy_serviceID(argc, argv);
+       if (service_id == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("No service identifier\n"));
+               exit(exit_code);
+       }
+
+       do_prefs_init();        /* initialization */
+       do_prefs_open(0, NULL); /* open default prefs */
+
+       current_set = SCNetworkSetCopyCurrent(prefs);
+       if (current_set == NULL) {
+               SCPrint(TRUE, stdout, CFSTR("nc_select SCNetworkSetCopyCurrent() failed: %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+
+       service = nc_copy_service(current_set, service_id);
+       if (service == NULL) {
+               SCPrint(TRUE, stdout, CFSTR("No service\n"));
+               goto done;
+       }
+
+#if !TARGET_OS_IPHONE
+       status = SCNetworkServiceSetEnabled(service, TRUE);
+       if (!status) {
+               SCPrint(TRUE, stdout, CFSTR("nc_select SCNetworkServiceSetEnabled() failed: %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+#else
+       status = SCNetworkSetSetSelectedVPNService(current_set, service);
+       if (!status) {
+               SCPrint(TRUE, stdout, CFSTR("nc_select SCNetworkSetSetSelectedVPNService() failed: %s\n"), SCErrorString(SCError()));
+               goto done;
+       }
+#endif
+
+       _prefs_save();
+       exit_code = 0;
+done:
+
+       my_CFRelease(&service_id);
+       my_CFRelease(&current_set);
+       _prefs_close();
+       exit(exit_code);
+}
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+typedef void (*nc_func) (int argc, char **argv);
+
+static const struct {
+       char            *cmd;
+       nc_func         func;
+} nc_cmds[] = {
+       { "list",               nc_list         },
+       { "ondemand",           nc_ondemand     },
+       { "resume",             nc_resume       },
+       { "select",             nc_select       },
+       { "show",               nc_show         },
+       { "start",              nc_start        },
+       { "statistics",         nc_statistics   },
+       { "status",             nc_status       },
+       { "stop",               nc_stop         },
+       { "suspend",            nc_suspend      },
+};
+#define        N_NC_CMNDS      (sizeof(nc_cmds) / sizeof(nc_cmds[0]))
+
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+int
+find_nc_cmd(char *cmd)
+{
+       int     i;
+
+       for (i = 0; i < (int)N_NC_CMNDS; i++) {
+               if (strcmp(cmd, nc_cmds[i].cmd) == 0) {
+                       return i;
+               }
+       }
+
+       return -1;
+}
+
+
+/* -----------------------------------------------------------------------------
+----------------------------------------------------------------------------- */
+void
+do_nc_cmd(char *cmd, int argc, char **argv, Boolean watch)
+{
+       int     i;
+
+       i = find_nc_cmd(cmd);
+       if (i >= 0) {
+               nc_func func;
+
+               func = nc_cmds[i].func;
+               if (watch && (func == nc_status)) {
+                       func = nc_watch;
+               }
+               (*func)(argc, argv);
+       }
+       return;
+}
+
diff --git a/scutil.tproj/nc.h b/scutil.tproj/nc.h
new file mode 100644 (file)
index 0000000..0541324
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010, 2011 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
+ *
+ * March1, 2010                        Christophe Allie <callie@apple.com>
+ * - initial revision
+ */
+
+#ifndef _NC_H
+#define _NC_H
+
+#include <sys/cdefs.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
+
+__BEGIN_DECLS
+
+int find_nc_cmd(char *cmd);
+void do_nc_cmd(char *cmd, int argc, char **argv, Boolean watch);
+
+__END_DECLS
+
+#endif /* !_NC_H */
index c7825b95958618c9cd9278132370d7ce20b10356..550032de147915940b88f18920ba171e0bca6c07 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2007, 2009-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -251,10 +251,12 @@ _process_options(optionsRef options, int nOptions, int argc, char **argv, CFMuta
 
                                if        ((strcasecmp(argv[0], "disable") == 0) ||
                                           (strcasecmp(argv[0], "no"     ) == 0) ||
+                                          (strcasecmp(argv[0], "off"    ) == 0) ||
                                           (strcasecmp(argv[0], "0"      ) == 0)) {
                                        CFDictionarySetValue(newConfiguration, *(options[optionIndex].key), CFNumberRef_0);
                                } else if ((strcasecmp(argv[0], "enable") == 0) ||
                                           (strcasecmp(argv[0], "yes"   ) == 0) ||
+                                          (strcasecmp(argv[0], "on"   ) == 0) ||
                                           (strcasecmp(argv[0], "1"     ) == 0)) {
                                        CFDictionarySetValue(newConfiguration, *(options[optionIndex].key), CFNumberRef_1);
                                } else {
@@ -690,8 +692,9 @@ do_net_create(int argc, char **argv)
                return;
        }
 
-       if (*net_keys[i].create == NULL) {
+       if (net_keys[i].create == NULL) {
                SCPrint(TRUE, stderr, CFSTR("create what?\n"));
+               return;
        }
 
        (*net_keys[i].create)(argc, argv);
@@ -716,8 +719,9 @@ do_net_disable(int argc, char **argv)
                return;
        }
 
-       if (*net_keys[i].disable == NULL) {
+       if (net_keys[i].disable == NULL) {
                SCPrint(TRUE, stderr, CFSTR("disable what?\n"));
+               return;
        }
 
        (*net_keys[i].disable)(argc, argv);
@@ -742,8 +746,9 @@ do_net_enable(int argc, char **argv)
                return;
        }
 
-       if (*net_keys[i].enable == NULL) {
+       if (net_keys[i].enable == NULL) {
                SCPrint(TRUE, stderr, CFSTR("enable what?\n"));
+               return;
        }
 
        (*net_keys[i].enable)(argc, argv);
@@ -768,8 +773,9 @@ do_net_remove(int argc, char **argv)
                return;
        }
 
-       if (*net_keys[i].remove == NULL) {
+       if (net_keys[i].remove == NULL) {
                SCPrint(TRUE, stderr, CFSTR("remove what?\n"));
+               return;
        }
 
        (*net_keys[i].remove)(argc, argv);
@@ -796,6 +802,7 @@ do_net_select(int argc, char **argv)
 
        if (*net_keys[i].select == NULL) {
                SCPrint(TRUE, stderr, CFSTR("select what?\n"));
+               return;
        }
 
        (*net_keys[i].select)(argc, argv);
@@ -984,12 +991,12 @@ do_net_snapshot(int argc, char **argv)
                                return;
                        }
 
-                       xmlData = CFPropertyListCreateXMLData(NULL, prefsPrivate->prefs);
+                       xmlData = CFPropertyListCreateData(NULL, prefsPrivate->prefs, kCFPropertyListXMLFormat_v1_0, 0, NULL);
                        if (xmlData != NULL) {
                                (void) write(fd, CFDataGetBytePtr(xmlData), CFDataGetLength(xmlData));
                                CFRelease(xmlData);
                        } else {
-                               SCPrint(TRUE, stdout, CFSTR("could not write snapshot: CFPropertyListCreateXMLData() failed\n"));
+                               SCPrint(TRUE, stdout, CFSTR("could not write snapshot: CFPropertyListCreateData() failed\n"));
                        }
 
                        (void) close(fd);
index 9cd9f3885e03a77104a0783c310f613dfc26b469..4303b33f56704f5cdd458f19cba2ef5a0410bfcb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -46,7 +46,7 @@ _copy_interfaces()
        CFMutableArrayRef       interfaces;
        CFArrayRef              real_interfaces;
 
-       real_interfaces = SCNetworkInterfaceCopyAll();
+       real_interfaces = _SCNetworkInterfaceCopyAllWithPreferences(prefs);
        if (real_interfaces == NULL) {
                SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
                return NULL;
@@ -61,6 +61,7 @@ _copy_interfaces()
        CFRelease(real_interfaces);
 
        // include pseudo interfaces
+       CFArrayAppendValue(interfaces, kSCNetworkInterfaceLoopback);
        CFArrayAppendValue(interfaces, kSCNetworkInterfaceIPv4);
 
        // include interfaces that we have created
@@ -116,8 +117,9 @@ _find_interface(int argc, char **argv, int *nArgs)
                }
 
                goto done;
-#if    !TARGET_OS_IPHONE
-       } else if (strcasecmp(argv[0], "$bond") == 0) {
+       }
+
+       else if (strcasecmp(argv[0], "$bond") == 0) {
                CFStringRef     interfaceType;
 
                if (net_interface == NULL) {
@@ -145,7 +147,39 @@ _find_interface(int argc, char **argv, int *nArgs)
                        goto done;
                }
                allowIndex = FALSE;
-       } else if (strcasecmp(argv[0], "$vlan") == 0) {
+       }
+
+       else if (strcasecmp(argv[0], "$bridge") == 0) {
+               CFStringRef     interfaceType;
+
+               if (net_interface == NULL) {
+                       SCPrint(TRUE, stdout, CFSTR("interface not selected\n"));
+                       goto done;
+               }
+
+               interfaceType = SCNetworkInterfaceGetInterfaceType(net_interface);
+               if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBridge)) {
+                       SCPrint(TRUE, stdout, CFSTR("interface not Bridge\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 = SCBridgeInterfaceGetMemberInterfaces(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) {
@@ -165,7 +199,6 @@ _find_interface(int argc, char **argv, int *nArgs)
                }
 
                goto done;
-#endif // !TARGET_OS_IPHONE
        }
 
        if ((myInterfaces == NULL) && (interfaces == NULL)) {
@@ -323,16 +356,18 @@ create_interface(int argc, char **argv)
        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, kSCNetworkInterfaceTypeBridge)) {
+               SCPrint(TRUE, stdout, CFSTR("bridge creation not yet supported\n"));
+               goto done;
+       }
        if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
                SCPrint(TRUE, stdout, CFSTR("vlan creation not yet supported\n"));
                goto done;
        }
-#endif // !TARGET_OS_IPHONE
 
        if (argc < 1) {
                if (net_interface == NULL) {
@@ -451,10 +486,56 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
        if (if_bsd_name != NULL) {
                CFArrayRef      available;
                CFDictionaryRef active;
+               CFDictionaryRef cap_current;
                int             mtu_cur;
                int             mtu_min;
                int             mtu_max;
 
+               cap_current = SCNetworkInterfaceCopyCapability(interface, NULL);
+               if (cap_current != NULL) {
+                       CFIndex                 i;
+                       CFArrayRef              cap_names;
+                       CFMutableArrayRef       cap_sorted;
+                       const void              **keys;
+                       CFIndex                 n;
+
+                       n = CFDictionaryGetCount(cap_current);
+                       keys = CFAllocatorAllocate(NULL, n * sizeof(CFStringRef), 0);
+                       CFDictionaryGetKeysAndValues(cap_current, keys, NULL);
+                       cap_names = CFArrayCreate(NULL, keys, n, &kCFTypeArrayCallBacks);
+                       CFAllocatorDeallocate(NULL, keys);
+
+                       cap_sorted = CFArrayCreateMutableCopy(NULL, 0, cap_names);
+                       CFRelease(cap_names);
+
+                       CFArraySortValues(cap_sorted, CFRangeMake(0, n), (CFComparatorFunction)CFStringCompare, NULL);
+
+                       SCPrint(TRUE, stdout, CFSTR("%@  capabilities         = "), prefix);
+                       for (i = 0; i < n; i++) {
+                               CFStringRef     cap_name;
+                               int             cap_val;
+                               CFNumberRef     val     = NULL;
+
+                               cap_name = CFArrayGetValueAtIndex(cap_sorted, i);
+                               if (configuration != NULL) {
+                                       val = CFDictionaryGetValue(configuration, cap_name);
+                               }
+                               if (!isA_CFNumber(val)) {
+                                       val = CFDictionaryGetValue(cap_current, cap_name);
+                               }
+
+                               SCPrint(TRUE, stdout, CFSTR("%s%@%c"),
+                                       (i == 0) ? "" : ",",
+                                       cap_name,
+                                       (CFNumberGetValue(val, kCFNumberIntType, &cap_val) &&
+                                        (cap_val != 0)) ? '+' : '-');
+                       }
+                       SCPrint(TRUE, stdout, CFSTR("\n"));
+
+                       CFRelease(cap_sorted);
+                       CFRelease(cap_current);
+               }
+
                if (SCNetworkInterfaceCopyMTU(interface, &mtu_cur, &mtu_min, &mtu_max)) {
                        char    isCurrent       = '*';
 
@@ -587,7 +668,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
 
                                                SCPrint(TRUE, stdout, CFSTR("\n"));
                                        }
-                                       CFRelease(subtype_options);
+                                       if (subtype_options != NULL) CFRelease(subtype_options);
                                }
                                if (subtypes != NULL) CFRelease(subtypes);
                        }
@@ -840,21 +921,47 @@ show_interfaces(int argc, char **argv)
 }
 
 
-#pragma mark -
-#pragma mark Bond options
+/* -------------------- */
 
 
-#if    !TARGET_OS_IPHONE
+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;
+}
+
+
+#pragma mark -
+#pragma mark Bond options
 
 
 static options bondOptions[] = {
        { "mtu"       , NULL, isNumber     , &kSCPropNetEthernetMTU         , NULL, NULL },
-// xxx  { "+device"   , ... },
-// xxx  { "-device"   , ... },
+       // xxx  { "+device"   , ... },
+       // xxx  { "-device"   , ... },
 
        { "?"         , NULL , isHelp     , NULL                            , NULL,
-           "\nBond configuration commands\n\n"
-           " set interface [mtu n] [media type] [mediaopts opts]\n"
+               "\nBond configuration commands\n\n"
+               " set interface [mtu n] [media type] [mediaopts opts]\n"
        }
 };
 #define        N_BOND_OPTIONS  (sizeof(bondOptions) / sizeof(bondOptions[0]))
@@ -884,7 +991,45 @@ set_interface_bond(int argc, char **argv, CFMutableDictionaryRef newConfiguratio
 }
 
 
-#endif // !TARGET_OS_IPHONE
+#pragma mark -
+#pragma mark Bridge options
+
+
+static options bridgeOptions[] = {
+       { "mtu"       , NULL, isNumber     , &kSCPropNetEthernetMTU         , NULL, NULL },
+// xxx  { "+device"   , ... },
+// xxx  { "-device"   , ... },
+
+       { "?"         , NULL , isHelp     , NULL                            , NULL,
+           "\nBridge configuration commands\n\n"
+           " set interface [mtu n] [media type] [mediaopts opts]\n"
+       }
+};
+#define        N_BRIDGE_OPTIONS        (sizeof(bridgeOptions) / sizeof(bridgeOptions[0]))
+
+
+static Boolean
+set_interface_bridge(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       CFStringRef     interfaceName;
+       Boolean         ok;
+
+       interfaceName = SCNetworkInterfaceGetBSDName(net_interface);
+       if (interfaceName == NULL) {
+               SCPrint(TRUE, stdout, CFSTR("no BSD interface\n"));
+               return FALSE;
+       }
+
+       ok = _process_options(bridgeOptions, N_BRIDGE_OPTIONS, argc, argv, newConfiguration);
+       if (ok) {
+               // validate configuration
+               if (!validateMediaOptions(net_interface, newConfiguration)) {
+                       return FALSE;
+               }
+       }
+
+       return ok;
+}
 
 
 #pragma mark -
@@ -932,11 +1077,60 @@ set_interface_airport(int argc, char **argv, CFMutableDictionaryRef newConfigura
 #pragma mark Ethernet options
 
 
+static int
+__doCapability(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       Boolean ok      = FALSE;
+
+       if (argc < 1) {
+               SCPrint(TRUE, stdout,
+                       CFSTR("%s not specified\n"),
+                       description != NULL ? description : "enable/disable");
+               return -1;
+       }
+
+       if (strlen(argv[0]) == 0) {
+               ok = SCNetworkInterfaceSetCapability(net_interface, key, NULL);
+       } else if ((strcasecmp(argv[0], "disable") == 0) ||
+                  (strcasecmp(argv[0], "no"     ) == 0) ||
+                  (strcasecmp(argv[0], "off"    ) == 0) ||
+                  (strcasecmp(argv[0], "0"      ) == 0)) {
+               ok = SCNetworkInterfaceSetCapability(net_interface, key, CFNumberRef_0);
+       } else if ((strcasecmp(argv[0], "enable") == 0) ||
+                  (strcasecmp(argv[0], "yes"   ) == 0) ||
+                  (strcasecmp(argv[0], "on"    ) == 0) ||
+                  (strcasecmp(argv[0], "1"     ) == 0)) {
+               ok = SCNetworkInterfaceSetCapability(net_interface, key, CFNumberRef_1);
+       } else {
+               SCPrint(TRUE, stdout, CFSTR("invalid value\n"));
+               return -1;
+       }
+
+       if (ok) {
+               updateInterfaceConfiguration(newConfiguration);
+       } else {
+               SCPrint(TRUE, stdout,
+                       CFSTR("%@ not updated: %s\n"),
+                       key,
+                       SCErrorString(SCError()));
+               return -1;
+       }
+
+       return 1;
+}
+
+
 static options ethernetOptions[] = {
        { "mtu"       , NULL, isNumber     , &kSCPropNetEthernetMTU         , NULL, NULL },
        { "media"     , NULL, isString     , &kSCPropNetEthernetMediaSubType, NULL, NULL },
        { "mediaopt"  , NULL, isStringArray, &kSCPropNetEthernetMediaOptions, NULL, NULL },
 
+       { "av"        , NULL, isOther      , &kSCPropNetEthernetCapabilityAV    , __doCapability, NULL },
+       { "lro"       , NULL, isOther      , &kSCPropNetEthernetCapabilityLRO   , __doCapability, NULL },
+       { "rxcsum"    , NULL, isOther      , &kSCPropNetEthernetCapabilityRXCSUM, __doCapability, NULL },
+       { "tso"       , NULL, isOther      , &kSCPropNetEthernetCapabilityTSO   , __doCapability, NULL },
+       { "txcsum"    , NULL, isOther      , &kSCPropNetEthernetCapabilityTXCSUM, __doCapability, NULL },
+
        { "?"         , NULL , isHelp     , NULL                            , NULL,
            "\nEthernet configuration commands\n\n"
            " set interface [mtu n] [media type] [mediaopts opts]\n"
@@ -973,44 +1167,18 @@ set_interface_ethernet(int argc, char **argv, CFMutableDictionaryRef newConfigur
 #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)
 {
+       CFStringRef     encryptionType;
+
        if (argc < 1) {
                SCPrint(TRUE, stdout, CFSTR("IPSec shared secret not specified\n"));
                return -1;
        }
 
+       encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetIPSecSharedSecretEncryption);
        if (strlen(argv[0]) > 0) {
-               CFStringRef     encryptionType;
-
-               encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetIPSecSharedSecretEncryption);
                if (encryptionType == NULL) {
                        CFIndex                 n;
                        CFMutableDataRef        pw;
@@ -1050,7 +1218,20 @@ __doIPSecSharedSecret(CFStringRef key, const char *description, void *info, int
                        return -1;
                }
        } else {
-               CFDictionaryRemoveValue(newConfiguration, key);
+               if (encryptionType == NULL) {
+                       CFDictionaryRemoveValue(newConfiguration, key);
+               } else if (CFEqual(encryptionType, kSCValNetIPSecSharedSecretEncryptionKeychain)) {
+                       Boolean         ok;
+                       ok = SCNetworkInterfaceRemovePassword(net_interface, kSCNetworkInterfacePasswordTypeIPSecSharedSecret);
+                       if (ok) {
+                               updateInterfaceConfiguration(newConfiguration);
+                       } else {
+                               return -1;
+                       }
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("IPSec shared secret type \"%@\" not supported\n"), encryptionType);
+                       return -1;
+               }
        }
 
        return 1;
@@ -1086,15 +1267,15 @@ __doIPSecSharedSecretType(CFStringRef key, const char *description, void *info,
 static int
 __doIPSecXAuthPassword(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
 {
+       CFStringRef     encryptionType;
+
        if (argc < 1) {
                SCPrint(TRUE, stdout, CFSTR("IPSec XAuth password not specified\n"));
                return -1;
        }
 
+       encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetIPSecXAuthPasswordEncryption);
        if (strlen(argv[0]) > 0) {
-               CFStringRef     encryptionType;
-
-               encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetIPSecXAuthPasswordEncryption);
                if (encryptionType == NULL) {
                        CFIndex                 n;
                        CFMutableDataRef        pw;
@@ -1134,7 +1315,21 @@ __doIPSecXAuthPassword(CFStringRef key, const char *description, void *info, int
                        return -1;
                }
        } else {
-               CFDictionaryRemoveValue(newConfiguration, key);
+               if (encryptionType == NULL) {
+                       CFDictionaryRemoveValue(newConfiguration, key);
+               } else if (CFEqual(encryptionType, kSCValNetIPSecXAuthPasswordEncryptionKeychain)) {
+                       Boolean         ok;
+
+                       ok = SCNetworkInterfaceRemovePassword(net_interface, kSCNetworkInterfacePasswordTypeIPSecXAuth);
+                       if (ok) {
+                               updateInterfaceConfiguration(newConfiguration);
+                       } else {
+                               return -1;
+                       }
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("IPSec XAuthPassword type \"%@\" not supported\n"), encryptionType);
+                       return -1;
+               }
        }
 
        return 1;
@@ -1437,15 +1632,15 @@ set_interface_modem(int argc, char **argv, CFMutableDictionaryRef newConfigurati
 static int
 __doPPPAuthPW(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
 {
+       CFStringRef     encryptionType;
+
        if (argc < 1) {
                SCPrint(TRUE, stdout, CFSTR("PPP password not specified\n"));
                return -1;
        }
 
+       encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetPPPAuthPasswordEncryption);
        if (strlen(argv[0]) > 0) {
-               CFStringRef     encryptionType;
-
-               encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetPPPAuthPasswordEncryption);
                if (encryptionType == NULL) {
                        CFIndex                 n;
                        CFMutableDataRef        pw;
@@ -1462,12 +1657,44 @@ __doPPPAuthPW(CFStringRef key, const char *description, void *info, int argc, ch
 
                        CFDictionarySetValue(newConfiguration, key, pw);
                        CFRelease(pw);
+               } else if (CFEqual(encryptionType, kSCValNetPPPAuthPasswordEncryptionKeychain)) {
+                       Boolean         ok;
+                       CFDataRef       pw;
+                       CFStringRef     str;
+
+                       str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+                       pw = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingUTF8, 0);
+                       ok = SCNetworkInterfaceSetPassword(net_interface,
+                                                          kSCNetworkInterfacePasswordTypePPP,
+                                                          pw,
+                                                          NULL);
+                       CFRelease(pw);
+                       CFRelease(str);
+                       if (ok) {
+                               updateInterfaceConfiguration(newConfiguration);
+                       } else {
+                               return -1;
+                       }
                } else {
                        SCPrint(TRUE, stdout, CFSTR("PPP password type \"%@\" not supported\n"), encryptionType);
                        return -1;
                }
        } else {
-               CFDictionaryRemoveValue(newConfiguration, key);
+               if (encryptionType == NULL) {
+                       CFDictionaryRemoveValue(newConfiguration, key);
+               } else if (CFEqual(encryptionType, kSCValNetPPPAuthPasswordEncryptionKeychain)) {
+                       Boolean         ok;
+
+                       ok = SCNetworkInterfaceRemovePassword(net_interface, kSCNetworkInterfacePasswordTypePPP);
+                       if (ok) {
+                               updateInterfaceConfiguration(newConfiguration);
+                       } else {
+                               return -1;
+                       }
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("PPP password type \"%@\" not supported\n"), encryptionType);
+                       return -1;
+               }
        }
 
        return 1;
@@ -1739,9 +1966,6 @@ set_interface_ppp(int argc, char **argv, CFMutableDictionaryRef newConfiguration
 #pragma mark VLAN options
 
 
-#if    !TARGET_OS_IPHONE
-
-
 static Boolean
 set_interface_vlan(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
 {
@@ -1751,7 +1975,161 @@ SCPrint(TRUE, stdout, CFSTR("vlan interface management not yet supported\n"));
 }
 
 
-#endif // !TARGET_OS_IPHONE
+#pragma mark -
+#pragma mark VPN options
+
+
+static int
+__doVPNAuthPW(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       CFStringRef     encryptionType;
+
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("VPN password not specified\n"));
+               return -1;
+       }
+
+       encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetVPNAuthPasswordEncryption);
+       if (strlen(argv[0]) > 0) {
+               if (encryptionType == NULL) {
+#ifdef USE_INLINE_CFDATA
+                       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);
+#else  // USE_INLINE_CFDATA
+                       CFStringRef             pw;
+
+                       pw = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+#endif // USE_INLINE_CFDATA
+
+                       CFDictionarySetValue(newConfiguration, key, pw);
+                       CFRelease(pw);
+               } else if (CFEqual(encryptionType, kSCValNetVPNAuthPasswordEncryptionKeychain)) {
+                       Boolean         ok;
+                       CFDataRef       pw;
+                       CFStringRef     str;
+
+                       str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+                       pw = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingUTF8, 0);
+                       ok = SCNetworkInterfaceSetPassword(net_interface,
+                                                          kSCNetworkInterfacePasswordTypeVPN,
+                                                          pw,
+                                                          NULL);
+                       CFRelease(pw);
+                       CFRelease(str);
+                       if (ok) {
+                               updateInterfaceConfiguration(newConfiguration);
+                       } else {
+                               return -1;
+                       }
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("VPN password type \"%@\" not supported\n"), encryptionType);
+                       return -1;
+               }
+       } else {
+               if (encryptionType == NULL) {
+                       CFDictionaryRemoveValue(newConfiguration, key);
+               } else if (CFEqual(encryptionType, kSCValNetVPNAuthPasswordEncryptionKeychain)) {
+                       Boolean         ok;
+
+                       ok = SCNetworkInterfaceRemovePassword(net_interface, kSCNetworkInterfacePasswordTypeVPN);
+                       if (ok) {
+                               updateInterfaceConfiguration(newConfiguration);
+                       } else {
+                               return -1;
+                       }
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("PPP password type \"%@\" not supported\n"), encryptionType);
+                       return -1;
+               }
+       }
+
+       return 1;
+}
+
+
+static int
+__doVPNAuthPWType(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("VPN password type mode not specified\n"));
+               return -1;
+       }
+
+       if (strlen(argv[0]) > 0) {
+               if (strcasecmp(argv[0], "keychain") == 0) {
+                       CFDictionarySetValue(newConfiguration, key, kSCValNetVPNAuthPasswordEncryptionKeychain);
+               } else if (strcasecmp(argv[0], "prompt") == 0) {
+                       CFDictionarySetValue(newConfiguration, key, kSCValNetVPNAuthPasswordEncryptionPrompt);
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("invalid password type\n"));
+                       return -1;
+               }
+       } else {
+               CFDictionaryRemoveValue(newConfiguration, key);
+       }
+
+       // encryption type changed, reset password
+       CFDictionaryRemoveValue(newConfiguration, kSCPropNetVPNAuthPassword);
+
+       return 1;
+}
+
+
+static selections vpnAuthenticationMethodSelections[] = {
+       { CFSTR("Password")    , &kSCValNetVPNAuthenticationMethodPassword    , 0 },
+       { CFSTR("Certificate") , &kSCValNetVPNAuthenticationMethodCertificate , 0 },
+       { NULL                 , NULL                                         , 0 }
+};
+
+
+static options vpnOptions[] = {
+       { "AuthName"                  , "account"     , isString     , &kSCPropNetVPNAuthName                  , NULL                , NULL                                      },
+       {   "Account"                 , "account"     , isString     , &kSCPropNetVPNAuthName                  , NULL                , NULL                                      },
+       { "AuthPassword"              , "password"    , isOther      , &kSCPropNetVPNAuthPassword              , __doVPNAuthPW       , NULL                                      },
+       {   "Password"                , "password"    , isOther      , &kSCPropNetVPNAuthPassword              , __doVPNAuthPW       , NULL                                      },
+       { "AuthPasswordEncryption"    , "type"        , isOther      , &kSCPropNetVPNAuthPasswordEncryption    , __doVPNAuthPWType   , NULL                                      },
+       { "AuthenticationMethod"      , NULL          , isChooseOne  , &kSCPropNetVPNAuthenticationMethod      , NULL                , (void *)vpnAuthenticationMethodSelections },
+       { "ConnectTime"               , "?time"       , isNumber     , &kSCPropNetVPNConnectTime               , NULL                , NULL                                      },
+       { "DisconnectOnFastUserSwitch", NULL          , isBoolean    , &kSCPropNetVPNDisconnectOnFastUserSwitch, NULL                , NULL                                      },
+       { "DisconnectOnIdle"          , NULL          , isBoolean    , &kSCPropNetVPNDisconnectOnIdle          , NULL                , NULL                                      },
+       { "DisconnectOnIdleTimer"     , "timeout"     , isNumber     , &kSCPropNetVPNDisconnectOnIdleTimer     , NULL                , NULL                                      },
+       { "DisconnectOnLogout"        , NULL          , isBoolean    , &kSCPropNetVPNDisconnectOnLogout        , NULL                , NULL                                      },
+       { "DisconnectOnSleep"         , NULL          , isBoolean    , &kSCPropNetVPNDisconnectOnSleep         , NULL                , NULL                                      },
+       { "Logfile"                   , "path"        , isString     , &kSCPropNetVPNLogfile                   , NULL                , NULL                                      },
+       { "MTU"                       , NULL          , isNumber     , &kSCPropNetVPNMTU                       , NULL                , NULL                                      },
+       { "RemoteAddress"             , "server"      , isString     , &kSCPropNetVPNRemoteAddress             , NULL                , NULL                                      },
+       {   "Server"                  , "server"      , isString     , &kSCPropNetVPNRemoteAddress             , NULL                , NULL                                      },
+       { "VerboseLogging"            , NULL          , isBoolean    , &kSCPropNetVPNVerboseLogging            , NULL                , NULL                                      },
+
+       // --- Help ---
+       { "?"                         , NULL          , isHelp       , NULL                                    , NULL                ,
+           "\nVPN configuration commands\n\n"
+           " set interface [Server server]\n"
+           " set interface [Account account]\n"
+           " set interface [Password password]\n"
+       }
+};
+#define        N_VPN_OPTIONS   (sizeof(vpnOptions) / sizeof(vpnOptions[0]))
+
+
+static Boolean
+set_interface_vpn(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       Boolean ok;
+
+       ok = _process_options(vpnOptions, N_VPN_OPTIONS, argc, argv, newConfiguration);
+       return ok;
+}
 
 
 #pragma mark -
@@ -1803,12 +2181,14 @@ set_interface(int argc, char **argv)
                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, kSCNetworkInterfaceTypeBridge)) {
+               ok = set_interface_bridge(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
                ok = set_interface_vlan(argc, argv, newConfiguration);
-#endif // !TARGET_OS_IPHONE
+       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVPN)) {
+               ok = set_interface_vpn(argc, argv, newConfiguration);
        } else {
                SCPrint(TRUE, stdout, CFSTR("this interfaces configuration cannot be changed\n"));
        }
index 0272c118640142ffcaeb63048f827196d4d1890a..2da53af8c11ea956bf7172806c3911c7af94e514 100644 (file)
@@ -417,128 +417,6 @@ select_protocol(int argc, char **argv)
 }
 
 
-#pragma mark -
-#pragma mark AppleTalk
-
-
-#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
-
-
-static selections appletalkConfigMethods[] = {
-       { CFSTR("node")      , &kSCValNetAppleTalkConfigMethodNode      , 0 },
-       { CFSTR("router")    , &kSCValNetAppleTalkConfigMethodRouter    , 0 },
-       { CFSTR("seedrouter"), &kSCValNetAppleTalkConfigMethodSeedRouter, 0 },
-       { NULL               , NULL                                     , 0 }
-};
-
-
-static int
-__doAppleTalkConfigMethod(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
-{
-       CFStringRef     configMethod;
-
-       configMethod = CFDictionaryGetValue(newConfiguration, key);
-       if (!CFEqual(key, kSCValNetAppleTalkConfigMethodSeedRouter)) {
-               CFDictionaryRemoveValue(newConfiguration, kSCPropNetAppleTalkSeedZones);
-               CFDictionaryRemoveValue(newConfiguration, kSCPropNetAppleTalkSeedNetworkRange);
-       }
-
-       return 0;
-}
-
-
-static int
-__doAppleTalkNetworkRange(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
-{
-       if (argc < 1) {
-               SCPrint(TRUE, stdout, CFSTR("network range not specified\n"));
-               return -1;
-       }
-
-       if (strlen(argv[0]) > 0) {
-               CFArrayRef      array;
-               char            *cp;
-               CFNumberRef     range[2];
-
-               range[0] = _copy_number(argv[0]);
-               if (range[0] == NULL) {
-                       SCPrint(TRUE, stdout, CFSTR("invalid start of range\n"));
-                       return -1;
-               }
-
-               cp = strchr(argv[0], '-');
-               if (cp == NULL) {
-                       range[1] = _copy_number(cp);
-                       if (range[1] == NULL) {
-                               CFRelease(range[0]);
-                               SCPrint(TRUE, stdout, CFSTR("invalid end of range\n"));
-                               return -1;
-                       }
-               } else {
-                       range[1] = CFRetain(range[0]);
-               }
-
-               array = CFArrayCreate(NULL,
-                                     (const void **)range,
-                                     sizeof(range)/sizeof(range[0]),
-                                     &kCFTypeArrayCallBacks);
-               CFRelease(range[0]);
-               CFRelease(range[1]);
-
-               CFDictionarySetValue(newConfiguration, key, array);
-               CFRelease(array);
-       } else {
-               CFDictionaryRemoveValue(newConfiguration, key);
-       }
-
-       return 1;
-}
-
-
-static options appletalkOptions[] = {
-       { "ConfigMethod"    , "configuration method"
-                                      , isChooseOne  , &kSCPropNetAppleTalkConfigMethod    , __doAppleTalkConfigMethod, (void *)appletalkConfigMethods },
-       {   "config"        , "configuration method"
-                                      , isChooseOne  , &kSCPropNetAppleTalkConfigMethod    , __doAppleTalkConfigMethod, (void *)appletalkConfigMethods },
-       { "DefaultZone"     , "zone"   , isString     , &kSCPropNetAppleTalkDefaultZone     , NULL                     , NULL                           },
-       { "NodeID"          , "node"   , isNumber     , &kSCPropNetAppleTalkNodeID          , NULL                     , NULL                           },
-       {   "node"          , "node"   , isNumber     , &kSCPropNetAppleTalkNodeID          , NULL                     , NULL                           },
-       { "NetworkID"       , "network", isNumber     , &kSCPropNetAppleTalkNetworkID       , NULL                     , NULL                           },
-       {   "network"       , "network", isNumber     , &kSCPropNetAppleTalkNetworkID       , NULL                     , NULL                           },
-       { "SeedNetworkRange", "range"  , isOther      , &kSCPropNetAppleTalkSeedNetworkRange, __doAppleTalkNetworkRange, NULL                           },
-       { "SeedZones"       , "zone"   , isStringArray, &kSCPropNetAppleTalkSeedZones       , NULL                     , NULL                           },
-
-       { "?"               , NULL   , isHelp       , NULL                                , NULL                     ,
-           "\nAppleTalk configuration commands\n\n"
-           " set protocol config {Node|Router|SeedRouter}\n"
-           " set protocol defaultzone zone\n"
-           " set protocol node id\n"
-           " set protocol network id\n"
-           "\n w/config=Node\n"
-           "   None\n"
-           "\n w/config=Router\n"
-           "   None\n"
-           "\n w/config=SeedRouter\n"
-           "   set protocol seednetworkrange low[-high]\n"
-           "   set protocol seedzones zone[,zone-2]\n"
-       }
-};
-#define        N_APPLETALK_OPTIONS     (sizeof(appletalkOptions) / sizeof(appletalkOptions[0]))
-
-
-static Boolean
-set_protocol_appletalk(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
-{
-       Boolean ok;
-
-       ok = _process_options(appletalkOptions, N_APPLETALK_OPTIONS, argc, argv, newConfiguration);
-       return ok;
-}
-
-
-#endif // !TARGET_OS_IPHONE && INCLUDE_APPLETALK
-
-
 #pragma mark -
 #pragma mark DNS
 
@@ -714,6 +592,12 @@ static options dnsOptions[] = {
        { "ServerAddresses", "address", isOther, &kSCPropNetDNSServerAddresses, __doDNSServerAddresses, NULL },
        {   "nameserver"   , "address", isOther, &kSCPropNetDNSServerAddresses, __doDNSServerAddresses, NULL },
        {   "nameservers"  , "address", isOther, &kSCPropNetDNSServerAddresses, __doDNSServerAddresses, NULL },
+       { "SupplementalMatchDomains",
+               "domain",
+               isOther,
+               &kSCPropNetDNSSupplementalMatchDomains,
+               __doDNSDomainArray,
+               NULL },
 
        { "?"              , NULL     , isHelp , NULL                         , NULL,
            "\nDNS configuration commands\n\n"
@@ -1598,10 +1482,6 @@ 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);
@@ -1869,18 +1749,6 @@ _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;
index 4b096a906fa84955be6c1e31321b874115413f43..5afdd082987cbbcee497a5ad8d3a3de8d4790627 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 /* -------------------- */
 
 
-__private_extern__
-CFComparisonResult
-_compare_services(const void *val1, const void *val2, void *context)
-{
-       CFStringRef             id1;
-       CFStringRef             id2;
-       CFArrayRef              order   = (CFArrayRef)context;
-       SCNetworkServiceRef     s1      = (SCNetworkServiceRef)val1;
-       SCNetworkServiceRef     s2      = (SCNetworkServiceRef)val2;
-
-       id1 = SCNetworkServiceGetServiceID(s1);
-       id2 = SCNetworkServiceGetServiceID(s2);
-
-       if (order != NULL) {
-               CFIndex o1;
-               CFIndex o2;
-               CFRange range;
-
-               range = CFRangeMake(0, CFArrayGetCount(order));
-               o1 = CFArrayGetFirstIndexOfValue(order, range, id1);
-               o2 = CFArrayGetFirstIndexOfValue(order, range, id2);
-
-               if (o1 > o2) {
-                       return (o2 != kCFNotFound) ? kCFCompareGreaterThan : kCFCompareLessThan;
-               } else if (o1 < o2) {
-                       return (o1 != kCFNotFound) ? kCFCompareLessThan    : kCFCompareGreaterThan;
-               }
-       }
-
-       return CFStringCompare(id1, id2, 0);
-}
-
-
 static SCNetworkServiceRef
 _find_service(char *match)
 {
@@ -975,7 +942,7 @@ show_services(int argc, char **argv)
                        sorted = CFArrayCreateMutableCopy(NULL, 0, services);
                        CFArraySortValues(sorted,
                                          CFRangeMake(0, CFArrayGetCount(sorted)),
-                                         _compare_services,
+                                         _SCNetworkServiceCompare,
                                          (void *)order);
                        CFRelease(services);
                        services = sorted;
index 6043472d45d89607251901007441126fa944b211..e67e81fb6e94e07d8581e8125a1c90b6181129af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2006, 2010 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -35,8 +35,6 @@
 
 __BEGIN_DECLS
 
-CFComparisonResult     _compare_services       (const void *val1, const void *val2, void *context);
-
 void   create_service          (int argc, char **argv);
 void   disable_service         (int argc, char **argv);
 void   enable_service          (int argc, char **argv);
index fa528f45d4bbbb9399991c39956fb5600e060774..6dfc9daa0192229b1f90280e0c3dd23c61c014fb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2004, 2005, 2009-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -485,6 +485,12 @@ set_set(int argc, char **argv)
 
                                CFAllocatorDeallocate(NULL, setID);
                        }
+               } else if (strcmp(command, "current") == 0) {
+                       ok = SCNetworkSetSetCurrent(net_set);
+                       if (!ok) {
+                               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+                               return;
+                       }
                } else {
                        SCPrint(TRUE, stdout, CFSTR("set what?\n"));
                }
@@ -542,7 +548,7 @@ show_set(int argc, char **argv)
                        sorted = CFArrayCreateMutableCopy(NULL, 0, services);
                        CFArraySortValues(sorted,
                                          CFRangeMake(0, CFArrayGetCount(sorted)),
-                                         _compare_services,
+                                         _SCNetworkServiceCompare,
                                          (void *)order);
                        CFRelease(services);
                        services = sorted;
index ad195e6bd849e1f2528dc10fdc8a541a0369edf3..aadfbe0ad0800c1e0c9a90359caccc8c2a91c0d9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2008-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -244,30 +244,31 @@ static void *
 _watcher(void *arg)
 {
        notifyRl = CFRunLoopGetCurrent();
-       if (!notifyRl) {
+       if (notifyRl == NULL) {
                SCPrint(TRUE, stdout, CFSTR("  CFRunLoopGetCurrent() failed\n"));
                return NULL;
        }
 
-#if    !TARGET_OS_IPHONE
        if (doDispatch) {
                if (!SCDynamicStoreSetDispatchQueue(store, dispatch_get_current_queue())) {
                        SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
+                       notifyRl = NULL;
                        return NULL;
                }
                notifyRls = (CFRunLoopSourceRef)kCFNull;
-       } else
-#endif // !TARGET_OS_IPHONE
-       {
+       } else {
                notifyRls = SCDynamicStoreCreateRunLoopSource(NULL, store, 0);
-               if (!notifyRls) {
+               if (notifyRls == NULL) {
                        SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
+                       notifyRl = NULL;
                        return NULL;
                }
                CFRunLoopAddSource(notifyRl, notifyRls, kCFRunLoopDefaultMode);
        }
 
+       pthread_setname_np("n.watch");
        CFRunLoopRun();
+       notifyRl = NULL;
        return NULL;
 }
 
@@ -278,7 +279,8 @@ do_notify_watch(int argc, char **argv)
        pthread_attr_t  tattr;
        pthread_t       tid;
 
-       if (notifyRl) {
+       if (notifyRl != NULL) {
+               SCPrint(TRUE, stdout, CFSTR("already active\n"));
                return;
        }
 
@@ -325,20 +327,53 @@ notificationWatcherVerbose(SCDynamicStoreRef store, void *arg)
 }
 
 
+static void *
+_callback(void *arg)
+{
+       SCDynamicStoreCallBack_v1       func  = (SCDynamicStoreCallBack_v1)arg;
+
+       notifyRl = CFRunLoopGetCurrent();
+       if (notifyRl == NULL) {
+               SCPrint(TRUE, stdout, CFSTR("  CFRunLoopGetCurrent() failed\n"));
+               return NULL;
+       }
+
+       if (!SCDynamicStoreNotifyCallback(store, notifyRl, func, "Changed detected by callback handler!")) {
+               SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
+               notifyRl = NULL;
+               return NULL;
+       }
+
+       pthread_setname_np("n.callback");
+       CFRunLoopRun();
+       notifyRl = NULL;
+       return NULL;
+}
+
+
 __private_extern__
 void
 do_notify_callback(int argc, char **argv)
 {
        SCDynamicStoreCallBack_v1       func  = notificationWatcher;
+       pthread_attr_t                  tattr;
+       pthread_t                       tid;
+
+       if (notifyRl != NULL) {
+               SCPrint(TRUE, stdout, CFSTR("already active\n"));
+               return;
+       }
 
        if ((argc == 1) && (strcmp(argv[0], "verbose") == 0)) {
                func = notificationWatcherVerbose;
        }
 
-       if (!SCDynamicStoreNotifyCallback(store, CFRunLoopGetCurrent(), func, "Changed detected by callback handler!")) {
-               SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
-               return;
-       }
+       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, _callback, (void *)func);
+       pthread_attr_destroy(&tattr);
 
        return;
 }
@@ -489,30 +524,26 @@ __private_extern__
 void
 do_notify_cancel(int argc, char **argv)
 {
-       if (notifyRls) {
-#if    !TARGET_OS_IPHONE
+       if (notifyRls != NULL) {
                if (doDispatch) {
                        if (!SCDynamicStoreSetDispatchQueue(store, NULL)) {
                                SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
                                return;
                        }
-               } else
-#endif // !TARGET_OS_IPHONE
-               {
+               } else {
                        CFRunLoopSourceInvalidate(notifyRls);
                        CFRelease(notifyRls);
                }
                notifyRls = NULL;
+       } else {
+               if (!SCDynamicStoreNotifyCancel(store)) {
+                       SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
+                       return;
+               }
        }
 
-       if (notifyRl) {
+       if (notifyRl != NULL) {
                CFRunLoopStop(notifyRl);
-               notifyRl  = NULL;
-       }
-
-       if (!SCDynamicStoreNotifyCancel(store)) {
-               SCPrint(TRUE, stdout, CFSTR("  %s\n"), SCErrorString(SCError()));
-               return;
        }
 
        if (oact != NULL) {
index 1ecf86e9166c82da7a09197d3cbb70c711a63d8c..4e201e14981befdd2191d8b282a916089824c635 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2008, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -133,15 +133,43 @@ __private_extern__
 Boolean
 _prefs_open(CFStringRef name, CFStringRef prefsID)
 {
-       if (geteuid() == 0) {
-               prefs = SCPreferencesCreate(NULL, name, prefsID);
-       } else {
+       CFMutableDictionaryRef  options         = NULL;
+       Boolean                 useHelper       = FALSE;
+       Boolean                 useOptions      = FALSE;
+
+       authorization = NULL;
+
+       if (geteuid() != 0) {
+               // if we need to use a helper
+               useHelper = TRUE;
+
 #if    !TARGET_OS_IPHONE
                authorization = _createAuthorization();
-#else  /* !TARGET_OS_IPHONE */
-               authorization = NULL;
 #endif /* !TARGET_OS_IPHONE */
+       }
+
+       if (getenv("SCPREFERENCES_REMOVE_WHEN_EMPTY") != NULL) {
+               // if we have options
+               useOptions = TRUE;
+
+               if (options == NULL) {
+                       options = CFDictionaryCreateMutable(NULL,
+                                                           0,
+                                                           &kCFTypeDictionaryKeyCallBacks,
+                                                           &kCFTypeDictionaryValueCallBacks);
+               }
+               CFDictionarySetValue(options, kSCPreferencesOptionRemoveWhenEmpty, kCFBooleanTrue);
+       }
+
+       if (!useHelper && !useOptions) {
+               // if no helper/options needed
+               prefs = SCPreferencesCreate(NULL, name, prefsID);
+       } else if (!useOptions) {
+               // if no options needed
                prefs = SCPreferencesCreateWithAuthorization(NULL, name, prefsID, authorization);
+       } else {
+               prefs = SCPreferencesCreateWithOptions(NULL, name, prefsID, authorization, options);
+               CFRelease(options);
        }
 
        if (prefs == NULL) {
@@ -241,27 +269,6 @@ _prefs_commitRequired(int argc, char **argv, const char *command)
 /* -------------------- */
 
 
-static CFStringRef
-_copyStringFromSTDIN()
-{
-       char            buf[1024];
-       size_t          len;
-       CFStringRef     utf8;
-
-       if (fgets(buf, sizeof(buf), stdin) == NULL) {
-               return NULL;
-       }
-
-       len = strlen(buf);
-       if (buf[len-1] == '\n') {
-               buf[--len] = '\0';
-       }
-
-       utf8 = CFStringCreateWithBytes(NULL, (UInt8 *)buf, len, kCFStringEncodingUTF8, TRUE);
-       return utf8;
-}
-
-
 static void
 get_ComputerName(int argc, char **argv)
 {
index 08703da3abab8f2bb9626817d8bf6b5ae0b70202..c506724c7453e6e546ce23688ba035346392bcf1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -45,6 +45,7 @@
  * - initial revision
  */
 
+#include <TargetConditionals.h>
 #include <ctype.h>
 #include <getopt.h>
 #include <stdio.h>
@@ -63,6 +64,7 @@
 #include "commands.h"
 #include "dictionary.h"
 #include "net.h"
+#include "nc.h"
 #include "prefs.h"
 #include "session.h"
 #include "tests.h"
@@ -99,10 +101,32 @@ static const struct option longopts[] = {
        { "prefs",              no_argument,            NULL,   0       },
        { "proxy",              no_argument,            NULL,   0       },
        { "set",                required_argument,      NULL,   0       },
+       { "nc",                 required_argument,      NULL,   0       },
        { NULL,                 0,                      NULL,   0       }
 };
 
 
+__private_extern__
+CFStringRef
+_copyStringFromSTDIN()
+{
+       char            buf[1024];
+       size_t          len;
+       CFStringRef     utf8;
+
+       if (fgets(buf, sizeof(buf), stdin) == NULL) {
+               return NULL;
+       }
+
+       len = strlen(buf);
+       if (buf[len-1] == '\n') {
+               buf[--len] = '\0';
+       }
+
+       utf8 = CFStringCreateWithBytes(NULL, (UInt8 *)buf, len, kCFStringEncodingUTF8, TRUE);
+       return utf8;
+}
+
 static char *
 getLine(char *buf, int len, InputRef src)
 {
@@ -133,7 +157,7 @@ getLine(char *buf, int len, InputRef src)
                } while ((n != '\n') && (n != EOF));
        }
 
-       if (src->h) {
+       if (src->h && (buf[0] != '\0')) {
                HistEvent       ev;
 
                history(src->h, &ev, H_ENTER, buf);
@@ -250,7 +274,7 @@ usage(const char *command)
        SCPrint(TRUE, stderr, CFSTR("usage: %s\n"), command);
        SCPrint(TRUE, stderr, CFSTR("\tinteractive access to the dynamic store.\n"));
        SCPrint(TRUE, stderr, CFSTR("\n"));
-       SCPrint(TRUE, stderr, CFSTR("   or: %s --prefs\n"), command);
+       SCPrint(TRUE, stderr, CFSTR("   or: %s --prefs [preference-file]\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 [-W] -r nodename\n"), command);
@@ -307,6 +331,7 @@ main(int argc, char * const argv[])
        int                     opti;
        const char              *prog   = argv[0];
        char                    *set    = NULL;
+       char                    *nc_cmd = NULL;
        InputRef                src;
        int                     timeout = 15;   /* default timeout (in seconds) */
        char                    *wait   = NULL;
@@ -364,6 +389,9 @@ main(int argc, char * const argv[])
                        } else if (strcmp(longopts[opti].name, "set") == 0) {
                                set = optarg;
                                xStore++;
+                       } else if (strcmp(longopts[opti].name, "nc") == 0) {
+                               nc_cmd = optarg;
+                               xStore++;
                        }
                        break;
                case '?':
@@ -377,7 +405,6 @@ main(int argc, char * const argv[])
                // if we are attempting to process more than one type of request
                usage(prog);
        }
-
        /* are we checking (or watching) the reachability of a host/address */
        if (doReach) {
                if (argc < 1) {
@@ -427,6 +454,15 @@ main(int argc, char * const argv[])
                /* NOT REACHED */
        }
 
+       /* network connection commands */
+       if (nc_cmd) {
+               if (find_nc_cmd(nc_cmd) < 0) {
+                       usage(prog);
+               }
+               do_nc_cmd(nc_cmd, argc, (char **)argv, watch);
+               /* NOT REACHED */
+       }
+
        if (doNet) {
                /* if we are going to be managing the network configuration */
                commands  = (cmdInfo *)commands_net;
@@ -445,7 +481,7 @@ main(int argc, char * const argv[])
 
                do_dictInit(0, NULL);   /* start with an empty dictionary */
                do_prefs_init();        /* initialization */
-               do_prefs_open(0, NULL); /* open default prefs */
+               do_prefs_open(argc, (char **)argv);     /* open prefs */
        } else {
                /* if we are going to be managing the dynamic store */
                commands  = (cmdInfo *)commands_store;
index 75bd7f4d41e191bea0b1ae51fed01c96090aab72..cbffecfedae16bff13c4525c7d0ebdf8b8e7a986 100644 (file)
@@ -64,7 +64,8 @@ extern CFMutableArrayRef      watchedPatterns;
 
 __BEGIN_DECLS
 
-Boolean        process_line                    (InputRef       src);
+Boolean                process_line            (InputRef       src);
+CFStringRef    _copyStringFromSTDIN    ();
 
 __END_DECLS
 
index 0cba63eea4ff40de44921ff214200517e513d3fc..6f00f3857468348afd93f162580d5ffed57a5952 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include "session.h"
 #include "notifications.h"
 
+
+static void
+reconnected(SCDynamicStoreRef store, void *info)
+{
+       SCPrint(TRUE, stdout, CFSTR("SCDynamicStore server restarted, session reconnected\n"));
+       return;
+}
+
+
 __private_extern__
 void
 do_open(int argc, char **argv)
@@ -67,6 +76,8 @@ do_open(int argc, char **argv)
                return;
        }
 
+       (void) SCDynamicStoreSetDisconnectCallBack(store, reconnected);
+
        watchedKeys     = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
        watchedPatterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
@@ -78,18 +89,22 @@ __private_extern__
 void
 do_close(int argc, char **argv)
 {
-       if (notifyRls) {
-               CFRunLoopSourceInvalidate(notifyRls);
-               CFRelease(notifyRls);
+       if (notifyRls != NULL) {
+               if (doDispatch) {
+                       (void) SCDynamicStoreSetDispatchQueue(store, NULL);
+               } else {
+                       CFRunLoopSourceInvalidate(notifyRls);
+                       CFRelease(notifyRls);
+               }
                notifyRls = NULL;
        }
 
-       if (notifyRl) {
+       if (notifyRl != NULL) {
                CFRunLoopStop(notifyRl);
                notifyRl  = NULL;
        }
 
-       if (store) {
+       if (store != NULL) {
                CFRelease(store);
                store = NULL;
                CFRelease(watchedKeys);
index cc9f95f7f7c0f2b39817c0555dec7853777406ba..471ac4c67cadfd683b03cde4e7f8c517054e7036 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2007-2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -51,6 +51,8 @@
 static SCNetworkReachabilityRef
 _setupReachability(int argc, char **argv, SCNetworkReachabilityContext *context)
 {
+       char                            *ip_address     = argv[0];
+       const char                      *interface;
        struct sockaddr_in              sin;
        struct sockaddr_in6             sin6;
        SCNetworkReachabilityRef        target  = NULL;
@@ -63,36 +65,120 @@ _setupReachability(int argc, char **argv, SCNetworkReachabilityContext *context)
        sin6.sin6_len    = sizeof(sin6);
        sin6.sin6_family = AF_INET6;
 
-       if (inet_aton(argv[0], &sin.sin_addr) == 1) {
+       interface = strchr(argv[0], '%');
+       if (interface != NULL) {
+               ip_address = strdup(argv[0]);
+               ip_address[interface - argv[0]] = '\0';
+               interface++;
+       }
+
+       if (inet_aton(ip_address, &sin.sin_addr) == 1) {
                if (argc == 1) {
-                       target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin);
-                       if (context != NULL) {
-                               context->info = "by address";
+                       if (interface == NULL) {
+                               target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin);
+                               if (context != NULL) {
+                                       context->info = "by address";
+                               }
+                       } else {
+                               CFDataRef               data;
+                               CFStringRef             str;
+                               CFMutableDictionaryRef  options;
+
+                               if (if_nametoindex(interface) == 0) {
+                                       SCPrint(TRUE, stderr, CFSTR("No interface: %s\n"), interface);
+                                       exit(1);
+                               }
+
+                               options = CFDictionaryCreateMutable(NULL,
+                                                                   0,
+                                                                   &kCFTypeDictionaryKeyCallBacks,
+                                                                   &kCFTypeDictionaryValueCallBacks);
+                               data = CFDataCreate(NULL, (const UInt8 *)&sin, sizeof(sin));
+                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionRemoteAddress, data);
+                               CFRelease(data);
+                               str  = CFStringCreateWithCString(NULL, interface, kCFStringEncodingASCII);
+                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionInterface, str);
+                               CFRelease(str);
+                               target = SCNetworkReachabilityCreateWithOptions(NULL, options);
+                               if (context != NULL) {
+                                       context->info = "by address w/scope";
+                               }
+                               CFRelease(options);
                        }
                } else {
+                       char                    *remote_address = argv[1];
+                       const char              *interface2;
                        struct sockaddr_in      r_sin;
 
+                       interface2 = strchr(argv[1], '%');
+                       if (interface2 != NULL) {
+                               remote_address = strdup(argv[1]);
+                               remote_address[interface2 - argv[1]] = '\0';
+                               interface2++;
+
+                               if ((interface != NULL) && (strcmp(interface, interface2) != 0)) {
+                                       SCPrint(TRUE, stderr,
+                                               CFSTR("Interface mismatch \"%s\" != \"%s\"\n"),
+                                               interface,
+                                               interface2);
+                                       exit(1);
+                               }
+
+                               interface = interface2;
+                       }
+
                        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]);
+                       if (inet_aton(remote_address, &r_sin.sin_addr) == 0) {
+                               SCPrint(TRUE, stderr, CFSTR("Could not interpret address \"%s\"\n"), remote_address);
                                exit(1);
                        }
 
-                       target = SCNetworkReachabilityCreateWithAddressPair(NULL,
-                                                                           (struct sockaddr *)&sin,
-                                                                           (struct sockaddr *)&r_sin);
-                       if (context != NULL) {
-                               context->info = "by address pair";
+                       if (remote_address != argv[1]) {
+                               free(remote_address);
+                       }
+
+                       if (interface == NULL) {
+                               target = SCNetworkReachabilityCreateWithAddressPair(NULL,
+                                                                                   (struct sockaddr *)&sin,
+                                                                                   (struct sockaddr *)&r_sin);
+                               if (context != NULL) {
+                                       context->info = "by address pair";
+                               }
+                       } else {
+                               CFDataRef               data;
+                               CFStringRef             str;
+                               CFMutableDictionaryRef  options;
+
+                               if (if_nametoindex(interface) == 0) {
+                                       SCPrint(TRUE, stderr, CFSTR("No interface: %s\n"), interface);
+                                       exit(1);
+                               }
+
+                               options = CFDictionaryCreateMutable(NULL,
+                                                                   0,
+                                                                   &kCFTypeDictionaryKeyCallBacks,
+                                                                   &kCFTypeDictionaryValueCallBacks);
+                               data = CFDataCreate(NULL, (const UInt8 *)&sin, sizeof(sin));
+                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionLocalAddress, data);
+                               CFRelease(data);
+                               data = CFDataCreate(NULL, (const UInt8 *)&r_sin, sizeof(r_sin));
+                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionRemoteAddress, data);
+                               CFRelease(data);
+                               str  = CFStringCreateWithCString(NULL, interface, kCFStringEncodingASCII);
+                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionInterface, str);
+                               CFRelease(str);
+                               target = SCNetworkReachabilityCreateWithOptions(NULL, options);
+                               if (context != NULL) {
+                                       context->info = "by address pair w/scope";
+                               }
+                               CFRelease(options);
                        }
                }
        } 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 (interface != NULL) {
+                       sin6.sin6_scope_id = if_nametoindex(interface);
                }
 
                if (argc == 1) {
@@ -111,9 +197,9 @@ _setupReachability(int argc, char **argv, SCNetworkReachabilityContext *context)
                                exit(1);
                        }
 
-                       p = strchr(argv[1], '%');
-                       if (p != NULL) {
-                               r_sin6.sin6_scope_id = if_nametoindex(p + 1);
+                       interface = strchr(argv[1], '%');
+                       if (interface != NULL) {
+                               r_sin6.sin6_scope_id = if_nametoindex(interface);
                        }
 
                        target = SCNetworkReachabilityCreateWithAddressPair(NULL,
@@ -151,8 +237,26 @@ _setupReachability(int argc, char **argv, SCNetworkReachabilityContext *context)
                                CFDataRef               data;
                                struct addrinfo         hints   = { 0 };
                                int                     i;
+                               int                     n_hints = 0;
 
                                for (i = 2; i < argc; i++) {
+                                       if (strcasecmp(argv[i], "interface") == 0) {
+                                               if (++i >= argc) {
+                                                       SCPrint(TRUE, stderr, CFSTR("No interface\n"));
+                                                       CFRelease(options);
+                                                       exit(1);
+                                               }
+                                               if (if_nametoindex(argv[i]) == 0) {
+                                                       SCPrint(TRUE, stderr, CFSTR("No interface: %s\n"), argv[i]);
+                                                       CFRelease(options);
+                                                       exit(1);
+                                               }
+                                               str  = CFStringCreateWithCString(NULL, argv[i], kCFStringEncodingASCII);
+                                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionInterface, str);
+                                               CFRelease(str);
+                                               continue;
+                                       }
+
                                        if (strcasecmp(argv[i], "AI_ADDRCONFIG") == 0) {
                                                hints.ai_flags |= AI_ADDRCONFIG;
                                        } else if (strcasecmp(argv[i], "AI_ALL") == 0) {
@@ -187,13 +291,17 @@ _setupReachability(int argc, char **argv, SCNetworkReachabilityContext *context)
                                                hints.ai_protocol = IPPROTO_UDP;
                                        } else {
                                                SCPrint(TRUE, stderr, CFSTR("Unrecognized hint: %s\n"), argv[i]);
+                                               CFRelease(options);
                                                exit(1);
                                        }
+                                       n_hints++;
                                }
 
-                               data = CFDataCreate(NULL, (const UInt8 *)&hints, sizeof(hints));
-                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionHints, data);
-                               CFRelease(data);
+                               if (n_hints > 0) {
+                                       data = CFDataCreate(NULL, (const UInt8 *)&hints, sizeof(hints));
+                                       CFDictionarySetValue(options, kSCNetworkReachabilityOptionHints, data);
+                                       CFRelease(data);
+                               }
                        }
                        if (CFDictionaryGetCount(options) > 0) {
                                target = SCNetworkReachabilityCreateWithOptions(NULL, options);
@@ -202,12 +310,17 @@ _setupReachability(int argc, char **argv, SCNetworkReachabilityContext *context)
                                }
                        } else {
                                SCPrint(TRUE, stderr, CFSTR("Must specify nodename or servname\n"));
+                               CFRelease(options);
                                exit(1);
                        }
                        CFRelease(options);
                }
        }
 
+       if (ip_address != argv[0]) {
+               free(ip_address);
+       }
+
        return target;
 }
 
@@ -378,15 +491,12 @@ do_watchReachability(int argc, char **argv)
                exit(1);
        }
 
-#if    !TARGET_OS_IPHONE
        if (doDispatch) {
                if (!SCNetworkReachabilitySetDispatchQueue(target_async, dispatch_get_current_queue())) {
                        printf("SCNetworkReachabilitySetDispatchQueue() failed: %s\n", SCErrorString(SCError()));
                        exit(1);
                }
-       } else
-#endif // !TARGET_OS_IPHONE
-       {
+       } else {
                if (!SCNetworkReachabilityScheduleWithRunLoop(target_async, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
                        printf("SCNetworkReachabilityScheduleWithRunLoop() failed: %s\n", SCErrorString(SCError()));
                        exit(1);
@@ -405,62 +515,107 @@ do_watchReachability(int argc, char **argv)
 }
 
 
-__private_extern__
-void
-do_showDNSConfiguration(int argc, char **argv)
+static void
+showResolver(dns_resolver_t *resolver, int index)
 {
-       dns_config_t    *dns_config;
+       int     i;
 
-       dns_config = dns_configuration_copy();
-       if (dns_config) {
-               int     n;
+       SCPrint(TRUE, stdout, CFSTR("\nresolver #%d\n"), index);
 
-               SCPrint(TRUE, stdout, CFSTR("DNS configuration\n"));
+       if (resolver->domain != NULL) {
+               SCPrint(TRUE, stdout, CFSTR("  domain   : %s\n"), resolver->domain);
+       }
 
-               for (n = 0; n < dns_config->n_resolver; n++) {
-                       int             i;
-                       dns_resolver_t  *resolver       = dns_config->resolver[n];
+       for (i = 0; i < resolver->n_search; i++) {
+               SCPrint(TRUE, stdout, CFSTR("  search domain[%d] : %s\n"), i, resolver->search[i]);
+       }
 
-                       SCPrint(TRUE, stdout, CFSTR("\nresolver #%d\n"), n + 1);
+       for (i = 0; i < resolver->n_nameserver; i++) {
+               char    buf[128];
 
-                       if (resolver->domain != NULL) {
-                               SCPrint(TRUE, stdout, CFSTR("  domain : %s\n"), resolver->domain);
-                       }
+               _SC_sockaddr_to_string(resolver->nameserver[i], buf, sizeof(buf));
+               SCPrint(TRUE, stdout, CFSTR("  nameserver[%d] : %s\n"), i, buf);
+       }
 
-                       for (i = 0; i < resolver->n_search; i++) {
-                               SCPrint(TRUE, stdout, CFSTR("  search domain[%d] : %s\n"), i, resolver->search[i]);
-                       }
+       for (i = 0; i < resolver->n_sortaddr; i++) {
+               char    abuf[32];
+               char    mbuf[32];
 
-                       for (i = 0; i < resolver->n_nameserver; i++) {
-                               char    buf[128];
+               (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);
+       }
 
-                               _SC_sockaddr_to_string(resolver->nameserver[i], buf, sizeof(buf));
-                               SCPrint(TRUE, stdout, CFSTR("  nameserver[%d] : %s\n"), i, buf);
-                       }
+       if (resolver->options != NULL) {
+               SCPrint(TRUE, stdout, CFSTR("  options  : %s\n"), resolver->options);
+       }
 
-                       for (i = 0; i < resolver->n_sortaddr; i++) {
-                               char    abuf[32];
-                               char    mbuf[32];
+       if (resolver->port != 0) {
+               SCPrint(TRUE, stdout, CFSTR("  port     : %hd\n"), resolver->port);
+       }
 
-                               (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->timeout != 0) {
+               SCPrint(TRUE, stdout, CFSTR("  timeout  : %d\n"), resolver->timeout);
+       }
 
-                       if (resolver->options != NULL) {
-                               SCPrint(TRUE, stdout, CFSTR("  options : %s\n"), resolver->options);
-                       }
+       if (resolver->if_index != 0) {
+               char    buf[IFNAMSIZ];
+               char    *if_name;
 
-                       if (resolver->port != 0) {
-                               SCPrint(TRUE, stdout, CFSTR("  port    : %hd\n"), resolver->port);
-                       }
+               if_name = if_indextoname(resolver->if_index, buf);
+               SCPrint(TRUE, stdout, CFSTR("  if_index : %d (%s)\n"),
+                       resolver->if_index,
+                       (if_name != NULL) ? if_name : "?");
+       }
 
-                       if (resolver->timeout != 0) {
-                               SCPrint(TRUE, stdout, CFSTR("  timeout : %d\n"), resolver->timeout);
-                       }
+       if (resolver->flags != 0) {
+               uint32_t        flags   = resolver->flags;
+
+               SCPrint(TRUE, stdout, CFSTR("  flags    : "));
+               if (flags & DNS_RESOLVER_FLAGS_SCOPED) {
+                       SCPrint(TRUE, stdout, CFSTR("Scoped"));
+                       flags &= ~DNS_RESOLVER_FLAGS_SCOPED;
+                       SCPrint(flags != 0, stdout, CFSTR(","));
+               }
+               if (flags != 0) {
+                       SCPrint(TRUE, stdout, CFSTR("0x%08x"), flags);
+               }
+               SCPrint(TRUE, stdout, CFSTR("\n"));
+       }
 
-                       if (resolver->search_order != 0) {
-                               SCPrint(TRUE, stdout, CFSTR("  order   : %d\n"), resolver->search_order);
+       if (resolver->search_order != 0) {
+               SCPrint(TRUE, stdout, CFSTR("  order    : %d\n"), resolver->search_order);
+       }
+
+       return;
+}
+
+
+__private_extern__
+void
+do_showDNSConfiguration(int argc, char **argv)
+{
+       dns_config_t    *dns_config;
+
+       dns_config = dns_configuration_copy();
+       if (dns_config) {
+               int     i;
+
+               SCPrint(TRUE, stdout, CFSTR("DNS configuration\n"));
+
+               for (i = 0; i < dns_config->n_resolver; i++) {
+                       dns_resolver_t  *resolver       = dns_config->resolver[i];
+
+                       showResolver(resolver, i + 1);
+               }
+
+               if ((dns_config->n_scoped_resolver > 0) && (dns_config->scoped_resolver != NULL)) {
+                       SCPrint(TRUE, stdout, CFSTR("\nDNS configuration (for scoped queries)\n"));
+
+                       for (i = 0; i < dns_config->n_scoped_resolver; i++) {
+                               dns_resolver_t  *resolver       = dns_config->scoped_resolver[i];
+
+                               showResolver(resolver, i + 1);
                        }
                }
 
@@ -473,6 +628,24 @@ do_showDNSConfiguration(int argc, char **argv)
 }
 
 
+static void
+showProxy(CFDictionaryRef proxy)
+{
+       CFMutableDictionaryRef  cleaned = NULL;
+
+       if (!_sc_debug) {
+               cleaned = CFDictionaryCreateMutableCopy(NULL, 0, proxy);
+               CFDictionaryRemoveValue(cleaned, kSCPropNetProxiesSupplemental);
+               CFDictionaryRemoveValue(cleaned, kSCPropNetProxiesScoped);
+               proxy = cleaned;
+       }
+
+       SCPrint(TRUE, stdout, CFSTR("%@\n"), proxy);
+       if (cleaned != NULL) CFRelease(cleaned);
+       return;
+}
+
+
 __private_extern__
 void
 do_showProxyConfiguration(int argc, char **argv)
@@ -481,7 +654,82 @@ do_showProxyConfiguration(int argc, char **argv)
 
        proxies = SCDynamicStoreCopyProxies(NULL);
        if (proxies != NULL) {
-               SCPrint(TRUE, stdout, CFSTR("%@\n"), proxies);
+               CFStringRef     interface       = NULL;
+               CFStringRef     server          = NULL;
+
+               while (argc > 0) {
+                       if (strcasecmp(argv[0], "interface") == 0) {
+                               argv++;
+                               argc--;
+
+                               if (argc < 1) {
+                                       SCPrint(TRUE, stderr, CFSTR("No interface\n"));
+                                       exit(1);
+                               }
+
+                               if (if_nametoindex(argv[0]) == 0) {
+                                       SCPrint(TRUE, stderr, CFSTR("No interface: %s\n"), argv[0]);
+                                       exit(1);
+                               }
+
+                               interface = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+                               argv++;
+                               argc--;
+                       } else {
+                               if (server != NULL) {
+                                       CFRelease(server);
+                               }
+
+                               server = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+                               argv++;
+                               argc--;
+                       }
+               }
+
+               if ((server != NULL) || (interface != NULL)) {
+                       CFArrayRef      matching;
+
+                       matching = SCNetworkProxiesCopyMatching(proxies, server, interface);
+                       if (matching != NULL) {
+                               CFIndex i;
+                               CFIndex n;
+
+                               if (server != NULL) {
+                                       if (interface != NULL) {
+                                               SCPrint(TRUE, stdout,
+                                                       CFSTR("server = %@, interface = %@\n"),
+                                                       server,
+                                                       interface);
+                                       } else {
+                                               SCPrint(TRUE, stdout,
+                                                       CFSTR("server = %@\n"),
+                                                       server);
+                                       }
+                               } else {
+                                       SCPrint(TRUE, stdout,
+                                               CFSTR("interface = %@\n"),
+                                               interface);
+                               }
+
+                               n = CFArrayGetCount(matching);
+                               for (i = 0; i < n; i++) {
+                                       CFDictionaryRef proxy;
+
+                                       proxy = CFArrayGetValueAtIndex(matching, i);
+                                       SCPrint(TRUE, stdout, CFSTR("\nproxy #%d\n"), i + 1);
+                                       showProxy(proxy);
+                               }
+
+                               CFRelease(matching);
+                       } else {
+                               SCPrint(TRUE, stdout, CFSTR("No matching proxy configurations\n"));
+                       }
+               } else {
+                       showProxy(proxies);
+               }
+
+               if (interface != NULL) CFRelease(interface);
+               if (server != NULL) CFRelease(server);
                CFRelease(proxies);
        } else {
                SCPrint(TRUE, stdout, CFSTR("No proxy configuration available\n"));