/*
- * Copyright (c) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2013-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
struct IPMonitorControl {
CFRuntimeBase cf_base;
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_t activity;
+#endif // VERBOSE_ACTIVITY_LOGGING
dispatch_queue_t queue;
xpc_connection_t connection;
CFMutableDictionaryRef assertions; /* ifname<string> = rank<number> */
if (control->connection != NULL) {
xpc_release(control->connection);
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
if (control->activity != NULL) {
os_release(control->activity);
}
+#endif // VERBOSE_ACTIVITY_LOGGING
if (control->queue != NULL) {
xpc_release(control->queue);
}
os_release(activity);
};
xpc_connection_set_event_handler(connection, handler);
- control->activity = os_activity_create("accessing IPMonitor [rank] controls",
- OS_ACTIVITY_CURRENT,
- OS_ACTIVITY_FLAG_DEFAULT);
+#ifdef VERBOSE_ACTIVITY_LOGGING
+ control->activity = os_activity_create("accessing IPMonitor [rank] controls",
+ OS_ACTIVITY_CURRENT,
+ OS_ACTIVITY_FLAG_DEFAULT);
+#endif // VERBOSE_ACTIVITY_LOGGING
control->connection = connection;
control->queue = queue;
xpc_connection_resume(connection);
return (FALSE);
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(control->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
request = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_uint64(request,
return rank;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(control->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
request = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_uint64(request,
/*
- * Copyright (c) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2013-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
STATIC void
AddChangedInterface(const void * key, const void * value, void * context)
{
+#pragma unused(value)
+#pragma unused(context)
InterfaceChangedListAddInterface((CFStringRef)key);
return;
}
xpc_object_t request,
xpc_object_t reply)
{
+#pragma unused(reply)
const char * ifname;
SCNetworkServicePrimaryRank rank;
ControlSessionRef session;
IPMonitorControlServerStart(CFRunLoopRef runloop, CFRunLoopSourceRef rls,
Boolean * verbose)
{
+#pragma unused(verbose)
dispatch_queue_t q;
xpc_connection_t connection;
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>MachServices</key>
<dict>
<key>com.apple.SystemConfiguration.DNSConfiguration_sim</key>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>MachServices</key>
<dict>
<key>com.apple.SystemConfiguration.DNSConfiguration</key>
+++ /dev/null
-? [= LoggerID com.apple.networking.IPMonitor] file $ENV(SIMULATOR_LOG_ROOT)/com.apple.networking.IPMonitor.log crashlog rotate=local file_max=1M compress format=$((Time)(local.6))\ $Host\ $(Sender)[$(PID)]\ <$((Level)(str))>:\ $(Message)
\ No newline at end of file
/*
- * Copyright (c) 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return @kConfigAgentTypeGeneric;
}
-+ (instancetype)agentFromData:(__unused NSData *)data
++ (instancetype)agentFromData:(NSData *)data
{
+#pragma unused(data)
return nil;
}
- (BOOL)startAgentWithOptions:(NSDictionary *)options
{
+#pragma unused(options)
BOOL ok = NO;
if (!self.active) {
self.active = YES;
return [[NSUUID alloc] initWithUUIDBytes:hashValue];
}
-@end
\ No newline at end of file
+@end
/*
- * Copyright (c) 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#import "controller.h"
#import <SystemConfiguration/SCPrivate.h>
+#import "ip_plugin.h"
#define numberToNSNumber(x) [NSNumber numberWithUnsignedInteger:x]
- (NEPolicySession *)createPolicySession
{
- NEPolicySession *session = nil;
-#if !TARGET_OS_IPHONE
- /* On OS X, since we cannot have entitlements, we open a kernel control
- * socket and use it to create a policy session
- */
-
- /* Create kernel control socket */
- int sock = -1;
- struct ctl_info kernctl_info;
- struct sockaddr_ctl kernctl_addr;
- const char *controlName = NECP_CONTROL_NAME;
-
- if ((sock = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL)) < 0)
- {
- SC_log(LOG_NOTICE, "Cannot create kernel control socket (errno = %d)\n", errno);
- return nil;
- }
-
- bzero(&kernctl_info, sizeof(kernctl_info));
- strlcpy(kernctl_info.ctl_name, controlName, sizeof(kernctl_info.ctl_name));
- if (ioctl(sock, CTLIOCGINFO, &kernctl_info))
- {
- SC_log(LOG_NOTICE, "ioctl failed on kernel control socket (errno = %d)\n", errno);
- close(sock);
- return nil;
- }
-
- bzero(&kernctl_addr, sizeof(kernctl_addr));
- kernctl_addr.sc_len = sizeof(kernctl_addr);
- kernctl_addr.sc_family = AF_SYSTEM;
- kernctl_addr.ss_sysaddr = AF_SYS_CONTROL;
- kernctl_addr.sc_id = kernctl_info.ctl_id;
- kernctl_addr.sc_unit = 0;
- if (connect(sock, (struct sockaddr *)&kernctl_addr, sizeof(kernctl_addr)))
- {
- SC_log(LOG_NOTICE, "connect failed on kernel control socket (errno = %d)\n", errno);
- close(sock);
- return nil;
- }
-
- /* Create policy session */
- session = [[NEPolicySession alloc] initWithSocket:sock];
- if (session == nil) {
- close(sock);
- }
-#else //!TARGET_OS_IPHONE
- session = [[NEPolicySession alloc] init];
-#endif //!TARGET_OS_IPHONE
-
- return session;
+ return [[NEPolicySession alloc] init];
}
- (BOOL)isControllerReady
resolver_list_t *resolvers = NULL;
if ((dns_config->n_resolver > 0) && (dns_config->resolver != NULL)) {
- int a = 0;
- int b = 0;
- int c = 0;
+ uint32_t a = 0;
+ uint32_t b = 0;
+ uint32_t c = 0;
resolvers = calloc(1, sizeof(resolver_list_t));
for (int i = 0; i < dns_config->n_resolver; i++) {
// For default resolvers, their name will be '_defaultDNS', '_defaultDNS #2' so on...
if (resolvers->n_default_resolvers > 0 && resolvers->default_resolvers != NULL) {
- for (int i = 0; i < resolvers->n_default_resolvers; i++) {
+ for (uint32_t i = 0; i < resolvers->n_default_resolvers; i++) {
dns_resolver_t *default_resolver = resolvers->default_resolvers[i];
NSData * data;
id dnsAgent;
agentSubType:kAgentSubTypeMulticast];
if (resolvers->n_multicast_resolvers > 0 && resolvers->multicast_resolvers != NULL) {
- for (int i = 0; i < resolvers->n_multicast_resolvers; i++) {
+ for (uint32_t i = 0; i < resolvers->n_multicast_resolvers; i++) {
dns_resolver_t * multicast_resolver = resolvers->multicast_resolvers[i];
id dnsAgent;
NSString * resolverName;
agentSubType:kAgentSubTypePrivate];
if (resolvers->n_private_resolvers > 0 && resolvers->private_resolvers != NULL) {
- for (int i = 0; i < resolvers->n_private_resolvers; i++) {
+ for (uint32_t i = 0; i < resolvers->n_private_resolvers; i++) {
dns_resolver_t * private_resolver = resolvers->private_resolvers[i];
id dnsAgent;
NSString * resolverName;
[self freeResolverList:resolvers];
}
-- (void)processScopedDNSResolvers:(dns_config_t *)dns_config;
+- (void)processScopedDNSResolvers:(dns_config_t *)dns_config
{
NSMutableArray * old_intf_list;
old_intf_list = [self getAgentList:self.floatingDNSAgentList
NSData * data;
id dnsAgent;
NSUInteger idx;
- char * if_name;
+ const char * if_name;
NSString * ns_if_name;
NSString * ns_if_name_with_prefix;
dns_resolver_t * resolver;
resolver = dns_config->scoped_resolver[i];
- if_name = if_indextoname(resolver->if_index, buf);
+ if_name = my_if_indextoname(resolver->if_index, buf);
if (if_name) {
ns_if_name = @(if_name);
ns_if_name_with_prefix = [NSString stringWithFormat:@"%s%@", prefixForInterfaceName, ns_if_name];
[self deleteAgentList:self.floatingDNSAgentList list:old_intf_list];
}
-- (void)processServiceSpecificDNSResolvers:(dns_config_t *)dns_config;
+- (void)processServiceSpecificDNSResolvers:(dns_config_t *)dns_config
{
NSMutableArray * old_service_list;
old_service_list = [self getAgentList:self.floatingDNSAgentList
/* Add a policy if there is a valid type. If POLICY_TYPE_NO_POLICY, then ignore policies.
* POLICY_TYPE_NO_POLICY will be set for service-specific agents, in which case we rely on
* service owners to install custom policies to point at the agents. */
- if (policyType >= NEPolicyResultTypeNone) {
+ if (policyType >= NEPolicyConditionTypeNone) {
BOOL useControlPolicySession = NO;
if (subtype == kAgentSubTypeGlobal) {
/* Policies for a Global scoped agents are at "control" level */
if ([globalProxyAgentList count] == 0 &&
[globalDNSAgentList count] == 0) {
- [self.controlPolicySession removeAllPolicies];
- [self.controlPolicySession apply];
+ ok = [self.controlPolicySession removeAllPolicies];
+ if (!ok) {
+ SC_log(LOG_ERR, "Could not remove policies for agent %@", [agent getAgentName]);
+ }
+
+ ok = [self.controlPolicySession apply];
+ if (!ok) {
+ SC_log(LOG_ERR, "Could not apply policy change for agent %@", [agent getAgentName]);
+ }
+
self.controlPolicySession = nil;
SC_log(LOG_NOTICE, "Closed control policy session");
}
#include "dns-configuration.h"
#include <dnsinfo.h>
-#include "dnsinfo_private.h"
-#include "dnsinfo_internal.h"
#include "dnsinfo_create.h"
+#include "dnsinfo_internal.h"
+#include "dnsinfo_logging.h"
+#include "dnsinfo_private.h"
#include "dnsinfo_server.h"
#include <network_information.h>
static void
add_dns_resolver_flags(const void *key, const void *value, void *context)
{
+#pragma unused(key)
CFDictionaryRef service = (CFDictionaryRef)value;
// CFStringRef serviceID = (CFStringRef)key;
uint32_t *resolver_flags = (uint32_t *)context;
static CFComparisonResult
compareBySearchOrder(const void *val1, const void *val2, void *context)
{
+#pragma unused(context)
CFDictionaryRef dns1 = (CFDictionaryRef)val1;
CFDictionaryRef dns2 = (CFDictionaryRef)val2;
CFNumberRef num1;
uint32_t defaultOrder = DEFAULT_SEARCH_ORDER;
CFArrayRef defaultSearchDomains = NULL;
CFIndex defaultSearchIndex = 0;
- CFIndex i;
CFMutableArrayRef mySearchDomains;
CFMutableArrayRef mySupplemental = NULL;
CFIndex n_supplemental;
+ CFStringRef trimmedDomainName;
mySearchDomains = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
CFIndex n_search;
n_search = CFArrayGetCount(defaultSearchDomains);
- for (i = 0; i < n_search; i++) {
+ for (int i = 0; i < n_search; i++) {
CFStringRef search;
search = CFArrayGetValueAtIndex(defaultSearchDomains, i);
}
}
} else {
- defaultDomainName = _SC_trimDomain(defaultDomainName);
- if (defaultDomainName != NULL) {
+ trimmedDomainName = _SC_trimDomain(defaultDomainName);
+#ifdef PERFORM_DOMAIN_EXPANSION
+ /*
+ * With BIND 4.8.3 (and earlier) resolvers, the default search list included
+ * the default domain and each of its parent domains with two or more labels.
+ */
+ if ((trimmedDomainName != NULL) &&
+ CFStringHasSuffix(defaultDomainName, CFSTR("."))) {
+ // if "domain" name is fully qualified
+ CFArrayAppendValue(mySearchDomains, trimmedDomainName);
+ CFRelease(trimmedDomainName);
+ } else if (trimmedDomainName != NULL) {
char *domain;
int domain_parts = 1;
char *dp;
const int ndots = 1;
- domain = _SC_cfstring_to_cstring(defaultDomainName,
+ domain = _SC_cfstring_to_cstring(trimmedDomainName,
NULL,
0,
kCFStringEncodingUTF8);
- CFRelease(defaultDomainName);
+ CFRelease(trimmedDomainName);
// count domain parts
for (dp = domain; *dp != '\0'; dp++) {
}
// move "domain" to "search" list (and expand as needed)
- i = LOCALDOMAINPARTS;
dp = domain;
do {
CFStringRef search;
}
dp = strchr(dp, '.') + 1;
- } while (++i <= (domain_parts - ndots));
+ } while (domain_parts-- > 2);
CFAllocatorDeallocate(NULL, domain);
}
+#else // PERFORM_DOMAIN_EXPANSION
+ /*
+ * With BIND 4.9.3 (and later) resolvers, the default search list included
+ * just the default domain.
+ */
+ if (trimmedDomainName != NULL) {
+ CFArrayAppendValue(mySearchDomains, trimmedDomainName);
+ CFRelease(trimmedDomainName);
+ }
+#endif // PERFORM_DOMAIN_EXPANSION
}
// add any supplemental "domain" names to the search list
NULL);
supplemental = mySupplemental;
}
- for (i = 0; i < n_supplemental; i++) {
+ for (int i = 0; i < n_supplemental; i++) {
CFDictionaryRef dns;
CFIndex domainIndex;
int noSearch;
uint32_t newFlags = 0;
CFDictionaryRef service = vals[i];
CFStringRef serviceID = keys[i];
+ CFArrayRef searchDomains;
dns = CFDictionaryGetValue(service, kSCEntNetDNS);
if (!isA_CFDictionary(dns)) {
newDNS = CFDictionaryCreateMutableCopy(NULL, 0, dns);
+ // add "Request A/AAAA query" flag(s)
+ newFlags |= DNS_RESOLVER_FLAGS_REQUEST_ALL_RECORDS;
+
+ // set search list
+ searchDomains = extract_search_domains(newDNS, NULL);
+ if (searchDomains != NULL) {
+ CFDictionarySetValue(newDNS, kSCPropNetDNSSearchDomains, searchDomains);
+ CFRelease(searchDomains);
+ searchDomains = NULL;
+ }
+
+ CFDictionaryRemoveValue(newDNS, kSCPropNetDNSSupplementalMatchDomains);
+ CFDictionaryRemoveValue(newDNS, kSCPropNetDNSSupplementalMatchOrders);
+
if (CFDictionaryContainsKey(newDNS, kSCPropInterfaceName)) {
- CFArrayRef searchDomains;
+ CFMutableDictionaryRef interfaceScopedDNS;
+ uint32_t interfaceScopedFlags;
- // set "scoped" configuration flag
- newFlags |= DNS_RESOLVER_FLAGS_SCOPED;
+ // The dictionary has an interface, so add a interface-scoped resolver
CFDictionarySetValue(newDNS, DNS_CONFIGURATION_SCOPED_QUERY_KEY, kCFBooleanTrue);
- CFDictionaryRemoveValue(newDNS, kSCPropNetDNSServiceIdentifier);
- // set search list
- searchDomains = extract_search_domains(newDNS, NULL);
- if (searchDomains != NULL) {
- CFDictionarySetValue(newDNS, kSCPropNetDNSSearchDomains, searchDomains);
- CFRelease(searchDomains);
- }
- } else {
- // set "service specific" configuration flag
- newFlags |= DNS_RESOLVER_FLAGS_SERVICE_SPECIFIC;
- }
+ interfaceScopedDNS = CFDictionaryCreateMutableCopy(NULL, 0, newDNS);
+ interfaceScopedFlags = newFlags;
- // add "Request A/AAAA query" flag(s)
- newFlags |= DNS_RESOLVER_FLAGS_REQUEST_ALL_RECORDS;
+ // set "scoped" configuration flag
+ interfaceScopedFlags |= DNS_RESOLVER_FLAGS_SCOPED;
+ merge_configuration_flags(interfaceScopedDNS, interfaceScopedFlags);
- merge_configuration_flags(newDNS, newFlags);
+ CFDictionaryRemoveValue(interfaceScopedDNS, kSCPropNetDNSServiceIdentifier);
- CFDictionaryRemoveValue(newDNS, kSCPropNetDNSSupplementalMatchDomains);
- CFDictionaryRemoveValue(newDNS, kSCPropNetDNSSupplementalMatchOrders);
+ add_resolver_signature(interfaceScopedDNS, "Service", serviceID, 0);
+ add_resolver(resolvers, interfaceScopedDNS);
+ CFRelease(interfaceScopedDNS);
+ }
+
+ // set "service specific" configuration flag
+ newFlags |= DNS_RESOLVER_FLAGS_SERVICE_SPECIFIC;
+ merge_configuration_flags(newDNS, newFlags);
add_resolver_signature(newDNS, "Service", serviceID, 0);
add_resolver(resolvers, newDNS);
int if_index;
if (CFNumberGetValue(num, kCFNumberIntType, &if_index)) {
- char if_name[IFNAMSIZ];
-
- _dns_resolver_set_if_index(&_resolver, if_index);
-
- if ((if_index != 0) &&
- (my_if_indextoname(if_index, if_name) != NULL)) {
- targetInterface = CFStringCreateWithCString(NULL,
- if_name,
- kCFStringEncodingASCII);
- targetInterfaceIndex = if_index;
+ char buf[IFNAMSIZ];
+ const char *if_name = NULL;
+
+ if (if_index != 0) {
+ if_name = my_if_indextoname(if_index, buf);
+ if (if_name != NULL) {
+ targetInterface = CFStringCreateWithCString(NULL,
+ if_name,
+ kCFStringEncodingASCII);
+ targetInterfaceIndex = if_index;
+ }
}
+
+ _dns_resolver_set_if_index(&_resolver, if_index, if_name);
}
}
CFArrayRef multicastResolvers,
CFArrayRef privateResolvers)
{
- dns_create_config_t _config;
+ dns_create_config_t dns_create_config;
Boolean changed = FALSE;
CFIndex i;
CFMutableDictionaryRef myDefault;
/*
* if no default and no supplemental/scoped resolvers
*/
- _config = NULL;
+ dns_create_config = NULL;
} else {
uint32_t default_resolver_flags = 0;
Boolean have_default_flags = FALSE;
/*
* if default and/or supplemental/scoped resolvers are defined
*/
- _config = _dns_configuration_create();
+ dns_create_config = _dns_configuration_create();
for (i = 0; i < n_resolvers; i++) {
Boolean merge_default_flags;
}
_resolver = create_resolver(resolver);
- _dns_configuration_add_resolver(&_config, _resolver);
+ _dns_configuration_add_resolver(&dns_create_config, _resolver);
_dns_resolver_free(&_resolver);
if (merge_default_flags) {
// add flatfile resolvers
_dnsinfo_flatfile_set_flags(default_resolver_flags);
- _dnsinfo_flatfile_add_resolvers(&_config);
+ _dnsinfo_flatfile_add_resolvers(&dns_create_config);
#endif // !TARGET_OS_IPHONE
}
// check if the configuration changed
- _dns_configuration_signature(&_config, signature, sizeof(signature));
+ _dns_configuration_signature(&dns_create_config, signature, sizeof(signature));
if (bcmp(signature, signature_last, sizeof(signature)) != 0) {
// save [new] signature
bcopy(signature, signature_last, sizeof(signature));
my_log(LOG_INFO, "Updating DNS configuration");
- if (_config != NULL) {
- uint8_t *buf;
- dns_config_t *config;
- _dns_config_buf_t *config_buf;
- uint32_t n_config;
- uint32_t n_padding;
-
- config_buf = (_dns_config_buf_t *)_config;
- n_config = sizeof(_dns_config_buf_t) + ntohl(config_buf->n_attribute);
- n_padding = ntohl(config_buf->n_padding);
- buf = malloc(n_config + n_padding);
- bcopy((void *)config_buf, buf, n_config);
- bzero(&buf[n_config], n_padding);
- /* ALIGN: cast okay since _dns_config_buf_t is int aligned */
- config = _dns_configuration_expand_config((_dns_config_buf_t *)(void *)buf);
- _dns_configuration_log(config, TRUE);
- free(buf);
+ if (dns_create_config != NULL) {
+ dns_config_t *dns_config = NULL;
+ _dns_config_buf_t *dns_config_buf;
+ size_t n;
+
+ n = sizeof(_dns_config_buf_t);
+ n += ntohl(((_dns_config_buf_t *)dns_create_config)->n_attribute);
+ dns_config_buf = _dns_configuration_buffer_create((void *)dns_create_config, n);
+ if (dns_config_buf != NULL) {
+ dns_config = _dns_configuration_buffer_expand(dns_config_buf);
+ if (dns_config == NULL) {
+ // if we were unable to expand the configuration
+ _dns_configuration_buffer_free(&dns_config_buf);
+ }
+ }
+
+ if (dns_config != NULL) {
+ _dns_configuration_log(dns_config, TRUE, NULL);
+ free(dns_config);
+ }
} else {
my_log(LOG_INFO, "*** No DNS configuration");
}
#ifndef MAIN
// save [new] configuration
- if (!_dns_configuration_store(&_config)) {
+ if (!_dns_configuration_store(&dns_create_config)) {
my_log(LOG_ERR, "could not store configuration");
}
#endif // MAIN
changed = TRUE;
}
- if (_config != NULL) _dns_configuration_free(&_config);
+ if (dns_create_config != NULL) {
+ _dns_configuration_free(&dns_create_config);
+ }
CFRelease(resolvers);
return changed;
static void
dns_configuration_changed(CFMachPortRef port, void *msg, CFIndex size, void *info)
{
+#pragma unused(port)
+#pragma unused(msg)
+#pragma unused(size)
+#pragma unused(info)
os_activity_t activity;
static const CFStringRef key = CFSTR(_PATH_RESOLVER_DIR);
CFArrayRef keys;
#include <dispatch/dispatch.h>
#include <CommonCrypto/CommonDigest.h>
+#include "ip_plugin.h"
+
#include <SystemConfiguration/SystemConfiguration.h>
#include <SystemConfiguration/SCDynamicStoreCopyDHCPInfo.h>
#include <SystemConfiguration/SCValidation.h>
#include <network_information.h>
#include "network_state_information_priv.h"
+#include "network_state_information_logging.h"
#include "network_information_server.h"
#include <ppp/ppp_msg.h>
-#include "ip_plugin.h"
#if !TARGET_OS_SIMULATOR
#include "set-hostname.h"
#endif /* !TARGET_OS_SIMULATOR */
#include "dns-configuration.h"
+
+#if !TARGET_OS_SIMULATOR
+#include "nat64-configuration.h"
+#endif /* !TARGET_OS_SIMULATOR */
+
#include "proxy-configuration.h"
#if !TARGET_OS_SIMULATOR
typedef unsigned int IFIndex;
+static dispatch_queue_t __network_change_queue();
+
#pragma mark -
#pragma mark Logging
static struct if_nameindex * S_if_nameindex_cache;
+static dispatch_queue_t
+__my_if_nametoindex_queue()
+{
+ static dispatch_once_t once;
+ static dispatch_queue_t q;
+
+ dispatch_once(&once, ^{
+ q = dispatch_queue_create("my_if_nametoindex queue", NULL);
+ });
+
+ return q;
+}
+
__private_extern__ IFIndex
my_if_nametoindex(const char * ifname)
{
- IFIndex idx = 0;
- struct if_nameindex * scan;
+ __block IFIndex idx = 0;
- if (S_if_nameindex_cache == NULL) {
- return (if_nametoindex(ifname));
- }
- for (scan = S_if_nameindex_cache;
- scan->if_index != 0 && scan->if_name != NULL;
- scan++) {
- if (strcmp(scan->if_name, ifname) == 0) {
- idx = scan->if_index;
- break;
+ dispatch_sync(__my_if_nametoindex_queue(), ^{
+ struct if_nameindex * scan;
+
+ if (S_if_nameindex_cache == NULL) {
+ idx = if_nametoindex(ifname);
+ return;
}
- }
+ for (scan = S_if_nameindex_cache;
+ scan->if_index != 0 && scan->if_name != NULL;
+ scan++) {
+ if (strcmp(scan->if_name, ifname) == 0) {
+ idx = scan->if_index;
+ break;
+ }
+ }
+ });
+
return (idx);
}
__private_extern__ const char *
my_if_indextoname(IFIndex idx, char if_name[IFNAMSIZ])
{
- const char * name = NULL;
- struct if_nameindex * scan;
+ __block const char * name = NULL;
- if (S_if_nameindex_cache == NULL) {
- return (if_indextoname(idx, if_name));
- }
- for (scan = S_if_nameindex_cache;
- scan->if_index != 0 && scan->if_name != NULL;
- scan++) {
- if (scan->if_index == idx) {
- name = if_name;
- strlcpy(if_name, scan->if_name, IFNAMSIZ);
- break;
+ dispatch_sync(__my_if_nametoindex_queue(), ^{
+ struct if_nameindex * scan;
+
+ if (S_if_nameindex_cache == NULL) {
+ name = if_indextoname(idx, if_name);
+ return;
}
- }
+ for (scan = S_if_nameindex_cache;
+ scan->if_index != 0 && scan->if_name != NULL;
+ scan++) {
+ if (scan->if_index == idx) {
+ name = if_name;
+ strlcpy(if_name, scan->if_name, IFNAMSIZ);
+ break;
+ }
+ }
+ });
+
return (name);
}
static void
my_if_freenameindex(void)
{
- if (S_if_nameindex_cache != NULL) {
- if_freenameindex(S_if_nameindex_cache);
- S_if_nameindex_cache = NULL;
- }
+ dispatch_sync(__my_if_nametoindex_queue(), ^{
+ if (S_if_nameindex_cache != NULL) {
+ if_freenameindex(S_if_nameindex_cache);
+ S_if_nameindex_cache = NULL;
+ }
+ });
+
return;
}
my_if_nameindex(void)
{
my_if_freenameindex();
- S_if_nameindex_cache = if_nameindex();
+ dispatch_sync(__my_if_nametoindex_queue(), ^{
+ S_if_nameindex_cache = if_nameindex();
+ });
+
return;
}
#define IP_CH(ip) ((u_char *)(ip))
#define IP_LIST(ip) IP_CH(ip)[0],IP_CH(ip)[1],IP_CH(ip)[2],IP_CH(ip)[3]
-static SCLoggerRef S_IPMonitor_logger;
-
static Boolean S_bundle_logging_verbose;
/*
}
/*
- * Type: Rank
- * Purpose:
- * A 32-bit value to encode the relative rank of a service.
- *
- * The top 8 bits are used to hold the rank assertion (first, default, last,
- * never, scoped);
- *
- * The bottom 24 bits are used to store the service index (i.e. the
- * position within the service order array).
+ * Rank support
*/
-#define RANK_ASSERTION_MAKE(r) ((Rank)(r) << 24)
-#define kRankAssertionFirst RANK_ASSERTION_MAKE(0)
-#define kRankAssertionDefault RANK_ASSERTION_MAKE(1)
-#define kRankAssertionLast RANK_ASSERTION_MAKE(2)
-#define kRankAssertionNever RANK_ASSERTION_MAKE(3)
-#define kRankAssertionScoped RANK_ASSERTION_MAKE(4)
-#define kRankAssertionMask RANK_ASSERTION_MAKE(0xff)
-#define RANK_ASSERTION_MASK(r) ((Rank)(r) & kRankAssertionMask)
-#define RANK_ASSERTION_GET(r) ((Rank)(r) >> 24)
-#define RANK_INDEX_MAKE(r) ((Rank)(r))
-#define kRankIndexMask RANK_INDEX_MAKE(0xffffff)
-#define RANK_INDEX_MASK(r) ((Rank)(r) & kRankIndexMask)
static __inline__ Rank
RankMake(uint32_t service_index, Rank primary_rank)
static Rank
PrimaryRankGetRankAssertion(CFStringRef rank_str, Boolean * is_set)
{
- int i;
struct {
const CFStringRef * name;
Rank rank_assertion;
};
if (rank_str != NULL) {
- for (i = 0; i < countof(values); i++) {
+ for (size_t i = 0; i < countof(values); i++) {
if (CFEqual(rank_str, *(values[i].name))) {
if (is_set != NULL) {
*is_set = TRUE;
#if !TARGET_OS_SIMULATOR
static IPv4RouteListRef S_ipv4_routelist = NULL;
static IPv6RouteListRef S_ipv6_routelist = NULL;
-
#endif /* !TARGET_OS_SIMULATOR */
static boolean_t S_append_state = FALSE;
static Boolean S_dnsinfo_synced = TRUE;
+#if !TARGET_OS_SIMULATOR
+// Note: access should be gated with __network_change_queue()
+static CFMutableSetRef S_nat64_prefix_changes = NULL;
+static CFMutableSetRef S_nat64_prefix_requests = NULL;
+#endif /* !TARGET_OS_SIMULATOR */
+
static nwi_state_t S_nwi_state = NULL;
static Boolean S_nwi_synced = TRUE;
#if !TARGET_OS_IPHONE
#define NETWORK_CHANGE_SMB 1<<3
#endif /* !TARGET_OS_IPHONE */
+#define NETWORK_CHANGE_NAT64 1<<4
static struct timeval S_network_change_start;
static Boolean S_network_change_timeout = FALSE;
static dispatch_source_t S_network_change_timer = NULL;
return;
}
-static void
-S_nwi_ifstate_dump(nwi_ifstate_t ifstate, int i)
-{
- const char * addr_str;
- void * address;
- char ntopbuf[INET6_ADDRSTRLEN];
- char vpn_ntopbuf[INET6_ADDRSTRLEN];
- const struct sockaddr * vpn_addr;
-
- address = nwi_ifstate_get_address(ifstate);
- addr_str = inet_ntop(ifstate->af, address, ntopbuf, sizeof(ntopbuf));
- vpn_addr = nwi_ifstate_get_vpn_server(ifstate);
- if (vpn_addr != NULL) {
- _SC_sockaddr_to_string(nwi_ifstate_get_vpn_server(ifstate),
- vpn_ntopbuf,
- sizeof(vpn_ntopbuf));
- }
- my_log(LOG_INFO,
- " [%d]: %s%s%s%s rank 0x%x iaddr %s%s%s reach_flags 0x%x",
- i, ifstate->ifname,
- nwi_ifstate_get_diff_str(ifstate),
- (ifstate->flags & NWI_IFSTATE_FLAGS_HAS_DNS) != 0
- ? " dns" : "",
- (ifstate->flags & NWI_IFSTATE_FLAGS_NOT_IN_LIST) != 0
- ? " never" : "",
- ifstate->rank,
- addr_str,
- (vpn_addr != NULL) ? " vpn_server_addr: " : "",
- (vpn_addr != NULL) ? vpn_ntopbuf : "",
- ifstate->reach_flags);
- return;
-}
-
-static void
-S_nwi_state_dump(nwi_state_t state)
-{
- int i;
- nwi_ifstate_t scan;
-
- if (state == NULL) {
- my_log(LOG_INFO, "nwi_state = <none>");
- return;
- }
- my_log(LOG_INFO,
- "nwi_state = { "
- "gen=%llu size=%lu #v4=%u #v6=%u "
- "reach_flags=(v4=0x%x, v6=0x%x) }",
- state->generation_count,
- nwi_state_size(state),
- state->ipv4_count,
- state->ipv6_count,
- nwi_state_get_reachability_flags(state, AF_INET),
- nwi_state_get_reachability_flags(state, AF_INET6));
- if (state->ipv4_count) {
- my_log(LOG_INFO, "IPv4:");
- for (i = 0, scan = nwi_state_ifstate_list(state, AF_INET);
- i < state->ipv4_count; i++, scan++) {
- S_nwi_ifstate_dump(scan, i);
- }
- }
- if (state->ipv6_count) {
- my_log(LOG_INFO, "IPv6:");
- for (i = 0, scan = nwi_state_ifstate_list(state, AF_INET6);
- i < state->ipv6_count; i++, scan++) {
- S_nwi_ifstate_dump(scan, i);
- }
- }
- if (state->max_if_count) {
- nwi_ifindex_t * ifindex;
-
- my_log(LOG_INFO, "%d interfaces:", state->if_list_count);
- for (i = 0, ifindex = nwi_state_if_list(state);
- i < state->if_list_count;
- i++, ifindex++) {
- my_log(LOG_INFO, "%s", state->ifstate_list[*ifindex].ifname);
- }
- }
- return;
-}
-
static boolean_t
S_is_network_boot()
{
return (isA_CFArray(CFDictionaryGetValue(dict, key)));
}
+#if !TARGET_OS_SIMULATOR
+static void
+my_CFSetAddValue_async(dispatch_queue_t queue, CFMutableSetRef *set, CFTypeRef value)
+{
+ CFRetain(value);
+ dispatch_async(queue, ^{
+ if (*set == NULL) {
+ *set = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+ }
+ CFSetAddValue(*set, value);
+ CFRelease(value);
+ });
+
+ return;
+}
+#endif /* !TARGET_OS_SIMULATOR */
+
static boolean_t
-cfstring_to_ipvx(int family, CFStringRef str, void * addr, int addr_size)
+cfstring_to_ipvx(int family, CFStringRef str, void * addr, size_t addr_size)
{
char buf[128];
r->prefix_length = IPV4_ROUTE_ALL_BITS_SET;
r->ifindex = ifindex;
r->ifa = addr;
- r->rank = primary_rank;
+ r->rank = rank;
r++;
/* add multicast route (rdar://problem/26457121) */
r->prefix_length = PREFIX_LENGTH_IN_CLASSD;
r->ifindex = ifindex;
r->ifa = addr;
- r->rank = primary_rank;
+ r->rank = rank;
r++;
}
static void
in6_maskaddr(struct in6_addr * addr, const struct in6_addr * mask)
{
- int i;
-
- for (i = 0; i < sizeof(addr->s6_addr); i++) {
+ for (size_t i = 0; i < sizeof(addr->s6_addr); i++) {
addr->s6_addr[i] &= mask->s6_addr[i];
}
return;
return (service_dict);
}
+
__private_extern__ boolean_t
service_is_scoped_only(CFDictionaryRef service_dict)
{
return (CFDictionaryGetValue(service_dict, entity));
}
+#if !TARGET_OS_SIMULATOR
+static CFStringRef
+service_copy_interface(CFStringRef serviceID, CFDictionaryRef new_service)
+{
+ CFDictionaryRef dict;
+ CFStringRef interface = NULL;
+
+ if (new_service != NULL) {
+ interface = ipdict_get_ifname(new_service);
+ }
+ if (interface == NULL) {
+ dict = service_dict_get(serviceID, kSCEntNetIPv4);
+ if (dict != NULL) {
+ interface = ipdict_get_ifname(dict);
+ }
+ }
+ if (interface == NULL) {
+ dict = service_dict_get(serviceID, kSCEntNetIPv6);
+ if (dict != NULL) {
+ interface = ipdict_get_ifname(dict);
+ }
+ }
+ if (interface != NULL) {
+ CFRetain(interface);
+ }
+ return interface;
+}
+#endif /* !TARGET_OS_SIMULATOR */
+
#ifndef kSCPropNetHostname
#define kSCPropNetHostname CFSTR("Hostname")
#endif
get_ipv4_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
CFDictionaryRef setup_dict, CFDictionaryRef info)
{
+#pragma unused(info)
CFDictionaryRef dict = NULL;
boolean_t changed = FALSE;
CFNumberRef rank_assertion = NULL;
return (changed);
}
+
static boolean_t
get_ipv6_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
CFDictionaryRef setup_dict, CFDictionaryRef info)
{
+#pragma unused(info)
CFDictionaryRef dict = NULL;
boolean_t changed = FALSE;
+#if !TARGET_OS_SIMULATOR
+ CFStringRef interface;
+#endif /* !TARGET_OS_SIMULATOR */
CFNumberRef rank_assertion = NULL;
CFDictionaryRef service_options;
if (state_dict == NULL) {
+ // if no State:
goto done;
}
+
service_options = service_dict_get(serviceID, kSCEntNetService);
if (service_options != NULL) {
rank_assertion
= CFDictionaryGetValue(service_options,
kServiceOptionRankAssertion);
}
+
dict = IPDictCreate(AF_INET6, state_dict, setup_dict, rank_assertion);
done:
+
+#if !TARGET_OS_SIMULATOR
+ interface = service_copy_interface(serviceID, dict);
+#endif /* !TARGET_OS_SIMULATOR */
+
#if !TARGET_OS_SIMULATOR
ipv6_service_update_router(serviceID, dict);
-#endif /* !TARGET_OS_SIMULATOR */
+#endif /* !TARGET_OS_SIMULATOR */
+
changed = service_dict_set(serviceID, kSCEntNetIPv6, dict);
+
+#if !TARGET_OS_SIMULATOR
+ if (interface != NULL) {
+ if (changed) {
+ // IPv6 configuration changed for this interface, poke NAT64
+ my_CFSetAddValue_async(__network_change_queue(), &S_nat64_prefix_changes, interface);
+ }
+ CFRelease(interface);
+ }
+#endif /* !TARGET_OS_SIMULATOR */
+
if (dict == NULL) {
- /* clean up the rank too */
+ /* service removed, clean up the rank too */
CFDictionaryRemoveValue(S_ipv6_service_rank_dict, serviceID);
}
my_CFRelease(&dict);
CFStringRef interface = NULL;
CFDictionaryRef ipv4;
CFDictionaryRef ipv6;
- int i;
const struct {
CFStringRef key;
uint32_t flags;
kSCPropNetDNSServiceIdentifier,
kSCPropNetDNSSupplementalMatchDomainsNoSearch,
};
- Boolean trust_state = FALSE;
+ Boolean trust_state = FALSE;
if ((state_dict == NULL) && (setup_dict == NULL)) {
/* there is no DNS content */
interface);
}
- for (i = 0; i < countof(merge_list); i++) {
+ for (size_t i = 0; i < countof(merge_list); i++) {
merge_array_prop(new_dict,
merge_list[i].key,
state_dict,
merge_list[i].append);
}
- for (i = 0; i < countof(pick_list); i++) {
+ for (size_t i = 0; i < countof(pick_list); i++) {
pick_prop(new_dict,
pick_list[i],
state_dict,
}
done:
+
+#if !TARGET_OS_SIMULATOR
+ if (interface != NULL) {
+ CFRetain(interface);
+ }
+#endif /* !TARGET_OS_SIMULATOR */
+
changed = service_dict_set(serviceID, kSCEntNetDNS, new_dict);
+
+#if !TARGET_OS_SIMULATOR
+ if (interface != NULL) {
+ if (changed) {
+ // DNS configuration changed for this interface, poke NAT64
+ my_CFSetAddValue_async(__network_change_queue(), &S_nat64_prefix_changes, interface);
+ }
+ CFRelease(interface);
+ }
+#endif /* !TARGET_OS_SIMULATOR */
+
my_CFRelease(&new_dict);
return (changed);
}
}
if ((setup_dict != NULL) && (state_dict != NULL)) {
- CFIndex i;
CFMutableDictionaryRef setup_copy;
/*
* the "Setup:" keys and others from the "State:" keys.
*/
new_dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
- for (i = 0; i < countof(merge_list); i++) {
+ for (size_t i = 0; i < countof(merge_list); i++) {
merge_array_prop(new_dict,
merge_list[i].key,
state_dict,
}
setup_copy = CFDictionaryCreateMutableCopy(NULL, 0, setup_dict);
- for (i = 0; i < countof(pick_list); i++) {
+ for (size_t i = 0; i < countof(pick_list); i++) {
if (CFDictionaryContainsKey(setup_copy, pick_list[i].key1)) {
/*
* if a "Setup:" enabled key has been provided than we want to
get_smb_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
CFDictionaryRef setup_dict, CFDictionaryRef info)
{
+#pragma unused(info)
boolean_t changed = FALSE;
- int i;
CFMutableDictionaryRef new_dict = NULL;
const CFStringRef pick_list[] = {
kSCPropNetSMBNetBIOSName,
setup_dict,
0,
FALSE);
- for (i = 0; i < countof(pick_list); i++) {
+ for (size_t i = 0; i < countof(pick_list); i++) {
pick_prop(new_dict,
pick_list[i],
state_dict,
CFDictionaryRef services_info)
{
boolean_t changed = FALSE;
- int i;
- for (i = 0; i < countof(transientServiceInfo); i++) {
+ for (size_t i = 0; i < countof(transientServiceInfo); i++) {
CFDictionaryRef dict;
CFNumberRef status = NULL;
CFMutableDictionaryRef ts_dict = NULL;
CFDictionaryRef setup_options, CFDictionaryRef services_info)
{
boolean_t changed = FALSE;
+ CFStringRef interface;
boolean_t ip_is_coupled = FALSE;
CFMutableDictionaryRef new_dict = NULL;
Rank rank_assertion = kRankAssertionDefault;
}
}
- if (!rank_assertion_is_set) {
- /* check for a rank assertion on the interface */
- CFStringRef interface;
-
- interface = services_info_get_interface(services_info, serviceID);
- if (interface != NULL) {
+ interface = services_info_get_interface(services_info, serviceID);
+ if (interface != NULL) {
+ if (!rank_assertion_is_set) {
+ /* check for a rank assertion on the interface */
CFNumberRef if_rank = NULL;
if (S_if_rank_dict != NULL) {
rank_assertion
= InterfaceRankGetRankAssertion(if_rank,
&rank_assertion_is_set);
+#define kNotSetString ((CFTypeRef)CFSTR("not set"))
my_log(LOG_INFO,
- "serviceID %@ interface %@ rank = %@",
+ "serviceID %@ interface %@ rank = 0x%x (%@)%s",
serviceID,
interface,
- (if_rank != NULL) ? (CFTypeRef)if_rank : (CFTypeRef)CFSTR("Not set)"));
+ rank_assertion,
+ (if_rank != NULL) ? (CFTypeRef)if_rank : kNotSetString,
+ ip_is_coupled ? " [coupled]" : "");
+ }
+ else {
+ my_log(LOG_INFO,
+ "serviceID %@ interface %@ rank = 0x%x%s",
+ serviceID, interface, rank_assertion,
+ ip_is_coupled ? " [coupled]" : "");
}
}
}
for (i = 0; i < ENTITY_TYPES_COUNT; i++) {
- key = setup_service_key(serviceID, *entityTypeNames[i]);
+ CFStringRef name = *entityTypeNames[i];
+
+ key = setup_service_key(serviceID, name);
CFArrayAppendValue(keys, key);
CFRelease(key);
- key = state_service_key(serviceID, *entityTypeNames[i]);
+ key = state_service_key(serviceID, name);
CFArrayAppendValue(keys, key);
CFRelease(key);
}
static void
add_transient_status_keys(CFStringRef service_id, CFMutableArrayRef patterns)
{
- int i;
-
- for (i = 0; i < countof(transientServiceInfo); i++) {
+ for (size_t i = 0; i < countof(transientServiceInfo); i++) {
CFStringRef pattern;
pattern = state_service_key(service_id,
static void
add_reachability_patterns(CFMutableArrayRef patterns)
{
- int i;
-
- for (i = 0; i < countof(reachabilitySetupKeys); i++) {
+ for (size_t i = 0; i < countof(reachabilitySetupKeys); i++) {
CFStringRef pattern;
pattern = setup_service_key(kSCCompAnyRegex, *reachabilitySetupKeys[i]);
CFArrayAppendValue(patterns, pattern);
CFMutableArrayRef get_keys;
CFMutableArrayRef get_patterns;
CFDictionaryRef info;
- CFIndex s;
count = CFArrayGetCount(service_list);
get_keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
CFArrayAppendValue(get_keys, S_multicast_resolvers);
CFArrayAppendValue(get_keys, S_private_resolvers);
- for (s = 0; s < count; s++) {
+ for (CFIndex s = 0; s < count; s++) {
CFStringRef serviceID = CFArrayGetValueAtIndex(service_list, s);
add_service_keys(serviceID, get_keys, get_patterns);
CFIndex n;
SCPrint(TRUE, f, CFSTR("#\n"));
- SCPrint(TRUE, f, CFSTR("# Mac OS X Notice\n"));
+ SCPrint(TRUE, f, CFSTR("# macOS Notice\n"));
+ SCPrint(TRUE, f, CFSTR("#\n"));
+ SCPrint(TRUE, f, CFSTR("# This file is not consulted for DNS hostname resolution, address\n"));
+ SCPrint(TRUE, f, CFSTR("# resolution, or the DNS query routing mechanism used by most\n"));
+ SCPrint(TRUE, f, CFSTR("# processes on this system.\n"));
SCPrint(TRUE, f, CFSTR("#\n"));
- SCPrint(TRUE, f, CFSTR("# This file is not used by the host name and address resolution\n"));
- SCPrint(TRUE, f, CFSTR("# or the DNS query routing mechanisms used by most processes on\n"));
- SCPrint(TRUE, f, CFSTR("# this Mac OS X system.\n"));
+ SCPrint(TRUE, f, CFSTR("# To view the DNS configuration used by this system, use:\n"));
+ SCPrint(TRUE, f, CFSTR("# scutil --dns\n"));
+ SCPrint(TRUE, f, CFSTR("#\n"));
+ SCPrint(TRUE, f, CFSTR("# SEE ALSO\n"));
+ SCPrint(TRUE, f, CFSTR("# dns-sd(1), scutil(8)\n"));
SCPrint(TRUE, f, CFSTR("#\n"));
SCPrint(TRUE, f, CFSTR("# This file is automatically generated.\n"));
SCPrint(TRUE, f, CFSTR("#\n"));
CFStringRef primary,
keyChangeListRef keys)
{
+#pragma unused(services_info)
Boolean changed = FALSE;
CFDictionaryRef dict = NULL;
// save [new] configuration
my_log(LOG_INFO, "Updating network information");
- S_nwi_state_dump(state);
+ _nwi_state_log(state, TRUE, NULL);
if (!_nwi_state_store(state)) {
my_log(LOG_ERR, "Notifying nwi_state_store failed");
CFStringRef primary,
keyChangeListRef keys)
{
+#pragma unused(services_info)
Boolean changed = FALSE;
CFDictionaryRef dict = NULL;
const void * value,
void * context)
{
- int i;
+#pragma unused(value)
CFStringRef service = key;
CFMutableArrayRef vif_setup_keys = context;
return;
}
- for (i = 0; i < countof(transientInterfaceEntityNames); i++) {
+ for (size_t i = 0; i < countof(transientInterfaceEntityNames); i++) {
if (CFStringHasSuffix(service, *transientInterfaceEntityNames[i])) {
CFArrayAppendValue(vif_setup_keys, service);
break;
CFStringRef *server_address,
int af)
{
- int i;
CFDictionaryRef entity_dict;
CFNumberRef num;
CFDictionaryRef p_state = NULL;
if (af == AF_INET) {
entity_dict = service_dict_get(service_id, kSCEntNetIPv4);
- }
- else {
+ } else {
entity_dict = service_dict_get(service_id, kSCEntNetIPv6);
}
entity_dict = ipdict_get_service(entity_dict);
return;
}
- for (i = 0; i < countof(transientServiceInfo); i++) {
+ for (size_t i = 0; i < countof(transientServiceInfo); i++) {
CFStringRef entity = *transientServiceInfo[i].entityName;
p_state = service_dict_get(service_id, entity);
* but a higher ranked service has IPv4 or IPv6.
*/
static Boolean
-ElectionResultsCandidateNeedsDemotion(ElectionResultsRef other_results,
+ElectionResultsCandidateNeedsDemotion(CandidateRef other_candidate,
CandidateRef candidate)
{
- CandidateRef other_candidate;
Boolean ret = FALSE;
- if (other_results == NULL
+ if (other_candidate == NULL
|| !candidate->ip_is_coupled
|| RANK_ASSERTION_MASK(candidate->rank) == kRankAssertionNever) {
goto done;
}
- other_candidate = other_results->candidates;
if (CFEqual(other_candidate->if_name, candidate->if_name)) {
/* they are over the same interface, no need to demote */
goto done;
/* we're higher ranked than the other candidate, ignore */
goto done;
}
+ if (candidate->rank == other_candidate->rank
+ && other_candidate->ip_is_coupled) {
+ /* same rank as another service that is coupled, ignore */
+ goto done;
+ }
ret = TRUE;
done:
return;
}
/*
- * Function: ElectionResultsCopyPrimary
+ * Function: ElectionResultsGetPrimary
* Purpose:
* Use the results of the current protocol and the other protocol to
* determine which service should become primary.
* At the same time, generate the IPv4/IPv6 routing table and
* the nwi_state for the protocol.
*/
-static CFStringRef
-ElectionResultsCopyPrimary(ElectionResultsRef results,
- ElectionResultsRef other_results,
- nwi_state_t nwi_state, int af,
- RouteListRef * ret_routes,
- CFDictionaryRef services_info)
-{
- CFStringRef primary = NULL;
+static CandidateRef
+ElectionResultsGetPrimary(ElectionResultsRef results,
+ CandidateRef other_candidate,
+ nwi_state_t nwi_state, int af,
+ RouteListRef * ret_routes,
+ CFDictionaryRef services_info)
+{
+ CandidateRef primary = NULL;
Boolean primary_is_null = FALSE;
RouteListRef routes = NULL;
if (!scan->ineligible
&& primary == NULL
&& RANK_ASSERTION_MASK(scan->rank) != kRankAssertionNever) {
- if (ElectionResultsCandidateNeedsDemotion(other_results,
+ if (ElectionResultsCandidateNeedsDemotion(other_candidate,
scan)) {
/* demote the service */
my_log(LOG_NOTICE,
skip = TRUE;
}
else {
- primary = CFRetain(scan->serviceID);
+ primary = scan;
is_primary = TRUE;
}
}
free(routes);
}
if (primary_is_null) {
- my_CFRelease(&primary);
+ primary = NULL;
}
return (primary);
}
services_info)) {
changed |= (1 << kEntityTypeServiceOptions);
}
+
/* update IPv4, IPv6, DNS, Proxies, SMB, ... */
for (i = 0; i < ENTITY_TYPES_COUNT; i++) {
- GetEntityChangesFuncRef func = entityChangeFunc[i];
+ GetEntityChangesFuncRef func;
+ CFStringRef name;
+
+ func = entityChangeFunc[i];
+ name = *entityTypeNames[i];
if ((*func)(serviceID,
- get_service_state_entity(services_info, serviceID,
- *entityTypeNames[i]),
- get_service_setup_entity(services_info, serviceID,
- *entityTypeNames[i]),
+ get_service_state_entity(services_info, serviceID, name),
+ get_service_setup_entity(services_info, serviceID, name),
services_info)) {
changed |= (1 << i);
}
}
+ /* update transient service status */
if (get_transient_status_changes(serviceID, services_info)) {
changed |= (1 << kEntityTypeTransientStatus);
}
// Set interface order into the kernel
struct if_order interface_order;
interface_order.ifo_count = (uint32_t)state->if_list_count;
- interface_order.ifo_ordered_indices = calloc((size_t)interface_order.ifo_count, sizeof(uint32_t));
+ interface_order.ifo_ordered_indices = (mach_vm_address_t)calloc((size_t)interface_order.ifo_count, sizeof(uint32_t));
if (((uint32_t *)interface_order.ifo_ordered_indices) != NULL) {
int i;
nwi_ifindex_t *scan;
success = TRUE;
}
if (((uint32_t *)interface_order.ifo_ordered_indices) != NULL) {
- free(interface_order.ifo_ordered_indices);
- interface_order.ifo_ordered_indices = NULL;
+ free((void *)interface_order.ifo_ordered_indices);
+ interface_order.ifo_ordered_indices = (mach_vm_address_t)NULL;
}
return success;
#ifdef MANAGE_IF_SIGNATURE
static int
siocsifnetsignature(int s, const char * ifname, int af,
- const uint8_t * signature, int signature_length)
+ const uint8_t * signature, size_t signature_length)
{
struct if_nsreq nsreq;
boolean_t smb_changed,
CFDictionaryRef old_primary_smb)
{
- int idx;
+#ifndef MANAGE_IF_ORDER
+#pragma unused(new_state)
+#pragma unused(old_state)
+#endif // !MANAGE_IF_ORDER
+#if TARGET_OS_IPHONE
+#pragma unused(smb_changed)
+#pragma unused(old_primary_smb)
+#endif // TARGET_OS_IPHONE
if (changes_state != NULL) {
const sa_family_t af_list[] = {AF_INET, AF_INET6};
}
#endif /* MANAGE_IF_ORDER */
- for (idx = 0; idx < countof(af_list); idx++) {
+ for (size_t idx = 0; idx < countof(af_list); idx++) {
int af = af_list[idx];
CFMutableStringRef changes = NULL;
CFMutableStringRef primary_str = NULL;
{
int status;
+ dispatch_assert_queue(__network_change_queue());
+
if (S_network_change_needed == 0) {
return;
}
/* We are about to post a network change to everyone, get the agents up to date */
+#if !TARGET_OS_SIMULATOR
+ if ((S_network_change_needed & NETWORK_CHANGE_DNS) != 0) {
+ /* Setup or Update config agents */
+ process_AgentMonitor_DNS();
+ }
+#endif //!TARGET_OS_SIMULATOR
if ((S_network_change_needed & NETWORK_CHANGE_NET) != 0) {
status = notify_post(_SC_NOTIFY_NETWORK_CHANGE_NWI);
}
if ((S_network_change_needed & NETWORK_CHANGE_DNS) != 0) {
-
-
-#if !TARGET_OS_SIMULATOR
- /* Setup or Update config agents */
- process_AgentMonitor_DNS();
-#endif //!TARGET_OS_SIMULATOR
status = notify_post(_SC_NOTIFY_NETWORK_CHANGE_DNS);
if (status != NOTIFY_STATUS_OK) {
my_log(LOG_ERR,
}
if ((S_network_change_needed & NETWORK_CHANGE_PROXY) != 0) {
-
#if !TARGET_OS_SIMULATOR
/* Setup or Update config agents */
process_AgentMonitor_Proxy();
}
}
- status = notify_post(_SC_NOTIFY_NETWORK_CHANGE);
- if (status != NOTIFY_STATUS_OK) {
- my_log(LOG_ERR,
- "notify_post(" _SC_NOTIFY_NETWORK_CHANGE ") failed: error=%d", status);
+ if ((S_network_change_needed & NETWORK_CHANGE_NAT64) != 0) {
+#if !TARGET_OS_SIMULATOR
+ // process any NAT64 prefix update requests (and refresh existing prefixes on change)
+ if ((S_nat64_prefix_requests != NULL) || (S_nat64_prefix_changes != NULL)) {
+ nat64_configuration_update(S_nat64_prefix_requests, S_nat64_prefix_changes);
+ my_CFRelease(&S_nat64_prefix_requests);
+ my_CFRelease(&S_nat64_prefix_changes);
+ }
+#endif /* !TARGET_OS_SIMULATOR */
+
+ S_network_change_needed &= ~(NETWORK_CHANGE_NAT64);
+ }
+
+ if (S_network_change_needed != 0) {
+ // if more than just a NAT64 prefix change
+ status = notify_post(_SC_NOTIFY_NETWORK_CHANGE);
+ if (status != NOTIFY_STATUS_OK) {
+ my_log(LOG_ERR,
+ "notify_post(" _SC_NOTIFY_NETWORK_CHANGE ") failed: error=%d", status);
+ }
}
S_network_change_needed = 0;
static void
post_network_change(uint32_t change)
{
+ dispatch_assert_queue(__network_change_queue());
+
if (S_network_change_needed == 0) {
// set the start time
(void) gettimeofday(&S_network_change_start, NULL);
boolean_t dnsinfo_changed = FALSE;
boolean_t global_ipv4_changed = FALSE;
boolean_t global_ipv6_changed = FALSE;
- CFIndex i;
keyChangeList keys;
CFIndex n;
+ boolean_t nat64_changed = FALSE;
CFMutableStringRef network_change_msg = NULL;
int n_services;
nwi_state_t old_nwi_state = NULL;
service_changes = CFArrayCreateMutable(NULL, 0,
&kCFTypeArrayCallBacks);
- for (i = 0; i < count; i++) {
- CFStringRef change = CFArrayGetValueAtIndex(changed_keys, i);
+ for (CFIndex i = 0; i < count; i++) {
+ CFStringRef change;
+#if !TARGET_OS_SIMULATOR
+ CFStringRef interface = NULL;
+#endif /* !TARGET_OS_SIMULATOR */
+
+ change = CFArrayGetValueAtIndex(changed_keys, i);
if (CFEqual(change, S_setup_global_ipv4)) {
global_ipv4_changed = TRUE;
global_ipv6_changed = TRUE;
}
}
else if (CFStringHasPrefix(change, S_setup_service_prefix)) {
- int j;
-
CFStringRef serviceID = parse_component(change,
S_setup_service_prefix);
if (serviceID) {
CFRelease(serviceID);
}
- for (j = 0; j < countof(transientInterfaceEntityNames); j++) {
+ for (size_t j = 0; j < countof(transientInterfaceEntityNames); j++) {
if (CFStringHasSuffix(change,
*transientInterfaceEntityNames[j])) {
reachability_changed = TRUE;
reachability_changed = TRUE;
}
}
+#if !TARGET_OS_SIMULATOR
+ else if (is_nat64_prefix_request(change, &interface)) {
+ my_CFSetAddValue_async(__network_change_queue(), &S_nat64_prefix_requests, interface);
+ nat64_changed = TRUE;
+ }
+#endif /* !TARGET_OS_SIMULATOR */
}
/* determine which serviceIDs are impacted by the interface rank changes */
if (if_rank_changes != NULL) {
n = CFArrayGetCount(if_rank_changes);
- for (i = 0; i < n; i++) {
+ for (CFIndex i = 0; i < n; i++) {
CFStringRef ifname = CFArrayGetValueAtIndex(if_rank_changes, i);
if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
}
}
+ /* process protocol (v4, v6, rank, ...) and configuration (dns, proxies, smb, ...) changes */
n = CFArrayGetCount(service_changes);
- for (i = 0; i < n; i++) {
+ for (CFIndex i = 0; i < n; i++) {
uint32_t changes;
CFStringRef serviceID;
global_ipv6_changed = TRUE;
dnsinfo_changed = TRUE;
proxies_changed = TRUE;
+ nat64_changed = TRUE;
}
}
if ((changes & (1 << kEntityTypeDNS)) != 0) {
dns_changed = TRUE;
}
dnsinfo_changed = TRUE;
+ nat64_changed = TRUE;
}
if ((changes & (1 << kEntityTypeProxies)) != 0) {
proxies_changed = TRUE;
if ((changes & (1 << kEntityTypeTransientStatus)) != 0
&& (service_dict_get(serviceID, kSCEntNetIPv4) != NULL
|| service_dict_get(serviceID, kSCEntNetIPv6) != NULL)) {
- dnsinfo_changed = TRUE;
- }
+ dnsinfo_changed = TRUE;
+ }
}
/* ensure S_nwi_state can hold as many services as we have currently */
CFStringRef new_primary_smb = NULL;
#endif /* !TARGET_OS_IPHONE */
RouteListUnion new_routelist;
+ CandidateRef other_candidate;
+ CandidateRef primary_candidate;
if (S_nwi_state != NULL) {
nwi_state_clear(S_nwi_state, AF_INET);
/* IPv4 */
my_log(LOG_DEBUG, "electing IPv4 primary");
new_routelist.ptr = NULL;
- new_primary = ElectionResultsCopyPrimary(S_ipv4_results,
- S_ipv6_results,
- S_nwi_state, AF_INET,
- &new_routelist.common,
- services_info);
+ other_candidate = (S_ipv6_results != NULL) /* get IPv6 primary */
+ ? S_ipv6_results->candidates : NULL;
+ primary_candidate = ElectionResultsGetPrimary(S_ipv4_results,
+ other_candidate,
+ S_nwi_state, AF_INET,
+ &new_routelist.common,
+ services_info);
+ new_primary = (primary_candidate != NULL)
+ ? primary_candidate->serviceID : NULL;
(void)set_new_primary(&S_primary_ipv4, new_primary, "IPv4");
update_ipv4(S_primary_ipv4, new_routelist.v4, &keys);
- my_CFRelease(&new_primary);
/* IPv6 */
my_log(LOG_DEBUG, "electing IPv6 primary");
new_routelist.ptr = NULL;
- new_primary = ElectionResultsCopyPrimary(S_ipv6_results,
- S_ipv4_results,
- S_nwi_state, AF_INET6,
- &new_routelist.common,
- services_info);
+ other_candidate = primary_candidate; /* get IPv4 primary */
+ primary_candidate = ElectionResultsGetPrimary(S_ipv6_results,
+ other_candidate,
+ S_nwi_state, AF_INET6,
+ &new_routelist.common,
+ services_info);
+ new_primary = (primary_candidate != NULL)
+ ? primary_candidate->serviceID : NULL;
(void)set_new_primary(&S_primary_ipv6, new_primary, "IPv6");
update_ipv6(S_primary_ipv6, new_routelist.v6, &keys);
- my_CFRelease(&new_primary);
nwi_state_finalize(S_nwi_state);
}
}
#endif /* !TARGET_OS_IPHONE */
+ if (nat64_changed) {
+ changes |= NETWORK_CHANGE_NAT64;
+ }
my_CFRelease(&service_changes);
my_CFRelease(&services_info);
my_log(LOG_NOTICE, "network changed:%@", network_change_msg);
} else if (keyChangeListActive(&keys)) {
my_log(LOG_NOTICE, "network changed");
+ } else if (nat64_changed) {
+ my_log(LOG_NOTICE, "nat64 update");
} else {
my_log(LOG_INFO, "network event w/no changes");
}
static void
IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
- void * not_used)
+ void * info)
{
+#pragma unused(info)
IPMonitorProcessChanges(session, changed_keys, NULL);
return;
}
#include "IPMonitorControlPrefs.h"
static void
-prefs_changed(__unused SCPreferencesRef prefs)
+prefs_changed(SCPreferencesRef prefs)
{
+#pragma unused(prefs)
if (S_bundle_logging_verbose || IPMonitorControlPrefsIsVerbose()) {
S_IPMonitor_debug = kDebugFlagDefault;
S_IPMonitor_verbose = TRUE;
- SCLoggerSetFlags(S_IPMonitor_logger, kSCLoggerFlagsFile | kSCLoggerFlagsDefault);
my_log(LOG_DEBUG, "Setting logging verbose mode on");
} else {
my_log(LOG_DEBUG, "Setting logging verbose mode off");
S_IPMonitor_debug = 0;
S_IPMonitor_verbose = FALSE;
- SCLoggerSetFlags(S_IPMonitor_logger, kSCLoggerFlagsDefault);
}
return;
}
-#define LOGGER_ID CFSTR("com.apple.networking.IPMonitor")
-static void
-my_log_init()
-{
- S_IPMonitor_logger = SCLoggerCreate(LOGGER_ID);
- return;
-
-}
-
-
#if !TARGET_OS_SIMULATOR
static int
flush_routes(int s)
CFSTR(kDNSServiceCompPrivateDNS));
CFArrayAppendValue(keys, S_private_resolvers);
+#if !TARGET_OS_SIMULATOR
+ /* add NAT64 prefix request pattern */
+ nat64_prefix_request_add_pattern(patterns);
+#endif /* !TARGET_OS_SIMULATOR */
+
if (!SCDynamicStoreSetNotificationKeys(S_session, keys, patterns)) {
my_log(LOG_ERR,
"SCDynamicStoreSetNotificationKeys() failed: %s",
static void
InterfaceRankChanged(void * info)
{
+#pragma unused(info)
os_activity_t activity;
CFDictionaryRef assertions = NULL;
CFArrayRef changes;
S_IPMonitor_verbose = TRUE;
}
- my_log_init();
-
- /* register to receive changes to verbose and read the initial setting */
+ /* register to receive changes to the "verbose" flag and read the initial setting */
IPMonitorControlPrefsInit(CFRunLoopGetCurrent(), prefs_changed);
prefs_changed(NULL);
+ /* start DNS configuration (dnsinfo) server */
load_DNSConfiguration(bundle, // bundle
^(Boolean inSync) { // syncHandler
dispatch_async(__network_change_queue(), ^{
});
});
+ /* start Network Information (nwi) server */
load_NetworkInformation(bundle, // bundle
^(Boolean inSync) { // syncHandler
dispatch_async(__network_change_queue(), ^{
post_network_change_when_ready();
});
});
+
#if !TARGET_OS_SIMULATOR
+ /* start IPMonitor Control (InterfaceRank) server */
StartIPMonitorControlServer();
#endif /* !TARGET_OS_IPHONE */
+ /* initialize DNS configuration */
dns_configuration_init(bundle);
+#if !TARGET_OS_SIMULATOR
+ /* initialize NAT64 configuration */
+ nat64_configuration_init(bundle);
+#endif /* !TARGET_OS_SIMULATOR */
+
+ /* initialize proxy configuration */
proxy_configuration_init(bundle);
ip_plugin_init();
#define kIsNULL CFSTR("IsNULL") /* CFBoolean */
-#ifdef TEST_ROUTELIST
-
-#define my_log(__level, __format, ...) SCPrint(TRUE, stdout, CFSTR(__format "\n"), ## __VA_ARGS__)
-
-#else /* TEST_ROUTELIST */
-
-#define my_log(__level, __format, ...) SC_log(__level, __format, ## __VA_ARGS__)
-
-#endif /* TEST_ROUTELIST */
+#ifndef my_log
+ #ifdef TEST_ROUTELIST
+ #define my_log(__level, __format, ...) SCPrint(TRUE, stdout, CFSTR(__format "\n"), ## __VA_ARGS__)
+ #else /* TEST_ROUTELIST */
+ #define my_log(__level, __format, ...) SC_log(__level, __format, ## __VA_ARGS__)
+ #endif /* TEST_ROUTELIST */
+#endif // !my_log
os_log_t
__log_IPMonitor();
--- /dev/null
+/*
+ * Copyright (c) 2017 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
+ *
+ * April 17, 2017 Allan Nathanson <ajn@apple.com>
+ * - initial revision
+ */
+
+
+#include "nat64-configuration.h"
+
+#include <TargetConditionals.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCPrivate.h>
+#include "ip_plugin.h"
+
+#define INET6 1
+
+#include <string.h>
+#include <net/if.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <network/nat64.h>
+
+
+static CFMutableSetRef nat64_prefix_requests = NULL;
+
+
+static dispatch_queue_t
+nat64_dispatch_queue()
+{
+ static dispatch_once_t once;
+ static dispatch_queue_t q;
+
+ dispatch_once(&once, ^{
+ q = dispatch_queue_create("nat64 prefix request queue", NULL);
+ });
+
+ return q;
+}
+
+
+static __inline__ void
+_nat64_prefix_request_complete(const char *if_name,
+ int32_t num_prefixes,
+ nw_nat64_prefix_t *prefixes)
+{
+ struct if_nat64req req;
+ int ret;
+ int s;
+
+ SC_log(LOG_DEBUG, "%s: _nat64_prefix_request_complete", if_name);
+
+ // pass NAT64 prefixes to the kernel
+ bzero(&req, sizeof(req));
+ strlcpy(req.ifnat64_name, if_name, sizeof(req.ifnat64_name));
+
+ if (num_prefixes == 0) {
+ SC_log(LOG_INFO, "%s: nat64 prefix not (or no longer) available", if_name);
+ }
+
+ for (int32_t i = 0; i < num_prefixes; i++) {
+ char prefix_str[NW_NAT64_PREFIX_STR_LENGTH] = {0};
+
+ nw_nat64_write_prefix_to_string(&prefixes[i], prefix_str, sizeof(prefix_str));
+ SC_log(LOG_DEBUG, "%s: nat64 prefix[%d] = %s", if_name, i, prefix_str);
+
+ if (i < NAT64_MAX_NUM_PREFIXES) {
+ req.ifnat64_prefixes[i].prefix_len = prefixes[i].length;
+ bcopy(&prefixes[i].data,
+ &req.ifnat64_prefixes[i].ipv6_prefix,
+ MIN(sizeof(req.ifnat64_prefixes[i].ipv6_prefix), sizeof(prefixes[i].data))); // MIN(16, 12)
+ }
+ }
+
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+ if (s == -1) {
+ SC_log(LOG_ERR, "socket() failed: %s", strerror(errno));
+ return;
+ }
+ ret = ioctl(s, SIOCSIFNAT64PREFIX, &req);
+ close(s);
+ if (ret == -1) {
+ if ((errno != ENOENT) || (num_prefixes != 0)) {
+ SC_log(LOG_ERR, "%s: ioctl(SIOCSIFNAT64PREFIX) failed: %s", if_name, strerror(errno));
+ }
+ return;
+ }
+
+ SC_log(LOG_INFO, "%s: nat64 prefix%s updated", if_name, (num_prefixes != 1) ? "es" : "");
+ return;
+}
+
+
+static void
+_nat64_prefix_request_start(const void *value)
+{
+ unsigned int if_index;
+ char *if_name;
+ CFStringRef interface = (CFStringRef)value;
+ bool ok;
+
+ SC_log(LOG_DEBUG, "%@: _nat64_prefix_request_start", interface);
+
+ if_name = _SC_cfstring_to_cstring(interface, NULL, 0, kCFStringEncodingASCII);
+ if (if_name == NULL) {
+ SC_log(LOG_NOTICE, "%@: could not convert interface name", interface);
+ return;
+ }
+
+ if_index = my_if_nametoindex(if_name);
+ if (if_index == 0) {
+ SC_log(LOG_NOTICE, "%s: no interface index", if_name);
+ CFAllocatorDeallocate(NULL, if_name);
+ return;
+ }
+
+ // keep track of interfaces with active nat64 prefix requests
+ CFSetAddValue(nat64_prefix_requests, interface);
+
+ CFRetain(interface);
+ ok = nw_nat64_copy_prefixes_async(&if_index,
+ nat64_dispatch_queue(),
+ ^(int32_t num_prefixes, nw_nat64_prefix_t *prefixes) {
+ if (num_prefixes >= 0) {
+ // update interface
+ _nat64_prefix_request_complete(if_name, num_prefixes, prefixes);
+ } else {
+ SC_log(LOG_ERR,
+ "%s: nw_nat64_copy_prefixes_async() num_prefixes(%d) < 0",
+ if_name,
+ num_prefixes);
+ }
+
+ if (num_prefixes <= 0) {
+ // remove from active list
+ CFSetRemoveValue(nat64_prefix_requests, interface);
+ }
+
+ // cleanup
+ CFRelease(interface);
+ CFAllocatorDeallocate(NULL, if_name);
+ });
+ if (!ok) {
+ SC_log(LOG_ERR, "%s: nw_nat64_copy_prefixes_async() failed", if_name);
+
+ // remove from active list
+ CFSetRemoveValue(nat64_prefix_requests, interface);
+
+ CFRelease(interface);
+ CFAllocatorDeallocate(NULL, if_name);
+ }
+
+ return;
+}
+
+
+static void
+_nat64_prefix_request(const void *value, void *context)
+{
+ CFSetRef changes = (CFSetRef)context;
+ CFStringRef interface = (CFStringRef)value;
+
+ if (!CFSetContainsValue(nat64_prefix_requests, interface) ||
+ ((changes != NULL) && CFSetContainsValue(changes, interface))) {
+ // if new request
+ // ... or a [refresh] request that hasn't already been started
+ _nat64_prefix_request_start(interface);
+ }
+
+ return;
+}
+
+
+static void
+_nat64_prefix_update(const void *value, void *context)
+{
+#pragma unused(context)
+ CFStringRef interface = (CFStringRef)value;
+
+ if (CFSetContainsValue(nat64_prefix_requests, interface)) {
+ _nat64_prefix_request_start(interface);
+ }
+
+ return;
+}
+
+
+#pragma mark -
+#pragma mark NAT64 prefix functions (for IPMonitor)
+
+
+__private_extern__
+Boolean
+is_nat64_prefix_request(CFStringRef change, CFStringRef *interface)
+{
+ CFArrayRef components;
+ static CFStringRef prefix = NULL;
+ Boolean yn = FALSE;
+ static dispatch_once_t once;
+
+ dispatch_once(&once, ^{
+ prefix = SCDynamicStoreKeyCreateNetworkInterface(NULL, kSCDynamicStoreDomainState);
+ });
+
+ *interface = NULL;
+ if (!CFStringHasPrefix(change, prefix) ||
+ !CFStringHasSuffix(change, kSCEntNetNAT64PrefixRequest)) {
+ return FALSE;
+ }
+
+ components = CFStringCreateArrayBySeparatingStrings(NULL, change, CFSTR("/"));
+ if (CFArrayGetCount(components) == 5) {
+ *interface = CFArrayGetValueAtIndex(components, 3);
+ CFRetain(*interface);
+ yn = TRUE;
+ }
+ CFRelease(components);
+
+ return yn;
+}
+
+
+__private_extern__ void
+nat64_prefix_request_add_pattern(CFMutableArrayRef patterns)
+{
+ CFStringRef pattern;
+
+ pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
+ kSCDynamicStoreDomainState,
+ kSCCompAnyRegex,
+ kSCEntNetNAT64PrefixRequest);
+ CFArrayAppendValue(patterns, pattern);
+ CFRelease(pattern);
+ return;
+}
+
+
+__private_extern__
+void
+nat64_configuration_init(CFBundleRef bundle)
+{
+#pragma unused(bundle)
+ nat64_prefix_requests = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+ return;
+}
+
+
+__private_extern__
+void
+nat64_configuration_update(CFSetRef requests, CFSetRef changes)
+{
+ // for any interface that changed, refresh the nat64 prefix
+ if (changes != NULL) {
+ CFSetApplyFunction(changes, _nat64_prefix_update, NULL);
+ }
+
+ // for any requested interface, query the nat64 prefix
+ if (requests != NULL) {
+ CFSetApplyFunction(requests, _nat64_prefix_request, (void *)changes);
+ }
+
+ return;
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 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 _NAT64_CONFIGURATION_H
+#define _NAT64_CONFIGURATION_H
+
+#include <TargetConditionals.h>
+#include <sys/cdefs.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+
+__BEGIN_DECLS
+
+Boolean
+is_nat64_prefix_request (CFStringRef change,
+ CFStringRef *interface);
+
+void
+nat64_prefix_request_add_pattern (CFMutableArrayRef patterns);
+
+void
+nat64_configuration_init (CFBundleRef bundle);
+
+void
+nat64_configuration_update (CFSetRef interface_changes,
+ CFSetRef interface_requests);
+
+__END_DECLS
+
+#endif /* _NAT64_CONFIGURATION_H */
/*
- * Copyright (c) 2011-2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2011-2017 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,
* 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@
*/
static CFComparisonResult
compareBySearchOrder(const void *val1, const void *val2, void *context)
{
+#pragma unused(context)
CFDictionaryRef proxy1 = (CFDictionaryRef)val1;
CFDictionaryRef proxy2 = (CFDictionaryRef)val2;
CFNumberRef num1;
static CFArrayRef
copy_supplemental_proxies(CFArrayRef proxies, Boolean skip)
{
+#pragma unused(skip)
CFIndex i;
CFIndex n_proxies;
CFMutableArrayRef supplemental = NULL;
/*
- * Copyright (c) 2004-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static void
ptr_query_callback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info)
{
+#pragma unused(info)
CFStringRef hostname = NULL;
struct timeval ptrQueryComplete;
struct timeval ptrQueryElapsed;
static void
update_hostname(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
{
+#pragma unused(changedKeys)
+#pragma unused(info)
CFStringRef address = NULL;
CFStringRef hostname = NULL;
CFStringRef serviceID = NULL;
void
load_hostname(Boolean verbose)
{
+#pragma unused(verbose)
CFStringRef key;
CFMutableArrayRef keys = NULL;
dispatch_block_t notify_block;
¬ify_token,
queue,
^(int token){
+#pragma unused(token)
CFRunLoopPerformBlock(rl,
kCFRunLoopDefaultMode,
notify_block);
/*
- * Copyright (c) 2006-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include "ip_plugin.h"
#endif // MAIN
-#define HW_MODEL_LEN 64 // Note: must be >= NETBIOS_NAME_LEN (below)
+#define HW_MODEL_LEN 64 // Note: must be >= NETBIOS_NAME_LEN (below)
-#define NETBIOS_NAME_LEN 16
+#define NETBIOS_NAME_LEN 16
-#define SMB_STARTUP_DELAY 60.0
-#define SMB_DEBOUNCE_DELAY 5.0
+#define SMB_STARTUP_DELAY 60.0
+#define SMB_DEBOUNCE_DELAY 5.0
+#define SMB_CONFIGURATION_QUEUE "com.apple.config.smb-configuration"
static SCDynamicStoreRef store = NULL;
static CFRunLoopRef rl = NULL;
static CFRunLoopSourceRef rls = NULL;
+static dispatch_queue_t queue = NULL;
static int notify_token = -1;
copy_default_name(void)
{
CFStringRef model;
- size_t n;
+ CFIndex n;
CFMutableStringRef str;
// get HW model name
static void
ptr_query_callback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info)
{
+#pragma unused(info)
CFDictionaryRef dict;
CFStringRef name;
CFMutableDictionaryRef newDict;
static void
-smb_update_configuration(__unused CFRunLoopTimerRef _timer, void *info)
+smb_update_configuration(CFRunLoopTimerRef _timer, void *info)
{
+#pragma unused(_timer)
CFStringRef address = NULL;
CFDictionaryRef dict;
CFStringRef name;
static void
configuration_changed(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
{
+#pragma unused(changedKeys)
+#pragma unused(info)
CFRunLoopTimerContext context = { 0, (void *)store, CFRetain, CFRelease, NULL };
CFAbsoluteTime time_boot;
CFAbsoluteTime time_now ;
void
load_smb_configuration(Boolean verbose)
{
+#pragma unused(verbose)
CFStringRef key;
CFMutableArrayRef keys = NULL;
dispatch_block_t notify_block;
uint32_t status;
/* initialize a few globals */
+ queue = dispatch_queue_create(SMB_CONFIGURATION_QUEUE, NULL);
+ if (queue == NULL) {
+ my_log(LOG_ERR,
+ "dispatch_queue_create() failed");
+ goto error;
+ }
store = SCDynamicStoreCreate(NULL, CFSTR("smb-configuration"), configuration_changed, NULL);
if (store == NULL) {
};
status = notify_register_dispatch(_SC_NOTIFY_NETWORK_CHANGE,
¬ify_token,
- dispatch_get_main_queue(),
+ queue,
^(int token){
+#pragma unused(token)
CFRunLoopPerformBlock(rl,
kCFRunLoopDefaultMode,
notify_block);
CFRelease(store);
store = NULL;
}
+ if (queue != NULL) {
+ dispatch_release(queue);
+ queue = NULL;
+ }
return;
}
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.14</string>
+ <string>1.17</string>
</dict>
</plist>
#include <CoreFoundation/CoreFoundation.h>
-#define SC_LOG_HANDLE __log_InterfaceNamer()
#include <SystemConfiguration/SystemConfiguration.h>
#include <SystemConfiguration/SCDPlugin.h>
#include <SystemConfiguration/SCPrivate.h>
#define WAIT_STACK_TIMEOUT_DEFAULT 300.0
#define WAIT_QUIET_TIMEOUT_KEY "WaitQuietTimeout"
-#define WAIT_QUIET_TIMEOUT_DEFAULT 60.0
+#define WAIT_QUIET_TIMEOUT_DEFAULT 240.0
/*
* S_connect
/*
* Logging
*/
-static os_log_t
+__private_extern__
+os_log_t
__log_InterfaceNamer()
{
static os_log_t log = NULL;
static CFComparisonResult
if_unit_compare(const void *val1, const void *val2, void *context)
{
+#pragma unused(context)
CFComparisonResult res;
CFNumberRef type1;
CFNumberRef type2;
SCPreferencesNotification notificationType,
void *info)
{
+#pragma unused(info)
os_activity_t activity;
if ((notificationType & kSCPreferencesNotificationApply) != kSCPreferencesNotificationApply) {
static void
updateBTPANInformation(const void *value, void *context)
{
+#pragma unused(context)
CFDataRef addr;
CFDictionaryRef dict = (CFDictionaryRef)value;
CFStringRef if_name;
set = SCNetworkSetCopyCurrent(prefs);
if (set == NULL) {
- SC_log(LOG_INFO, "No current set");
- goto done;
+ SC_log(LOG_INFO, "No current set, adding default");
+ set = _SCNetworkSetCreateDefault(prefs);
+ if (set == NULL) {
+ SC_log(LOG_NOTICE, "_SCNetworkSetCreateDefault() failed: %s", SCErrorString(SCError()));
+ goto done;
+ }
}
- n = CFArrayGetCount(if_list);
+ n = (if_list != NULL) ? CFArrayGetCount(if_list) : 0;
for (i = 0; i < n; i++) {
SCNetworkInterfaceRef interface;
static void
interfaceArrivalCallback(void *refcon, io_iterator_t iter)
{
+#pragma unused(refcon)
os_activity_t activity;
io_object_t obj;
static void
stackCallback(void *refcon, io_iterator_t iter)
{
+#pragma unused(refcon)
os_activity_t activity;
kern_return_t kr;
io_object_t stack;
natural_t messageType,
void *messageArgument)
{
+#pragma unused(refcon)
+#pragma unused(service)
os_activity_t activity;
if (messageArgument != NULL) {
static void
timerCallback(CFRunLoopTimerRef timer, void *info)
{
+#pragma unused(timer)
+#pragma unused(info)
os_activity_t activity;
activity = os_activity_create("process IOKit timer",
static Boolean
setup_IOKit(CFBundleRef bundle)
{
+#pragma unused(bundle)
uint32_t busy;
kern_return_t kr;
mach_port_t masterPort = MACH_PORT_NULL;
static Boolean
setup_Virtual(CFBundleRef bundle)
{
+#pragma unused(bundle)
// open a SCPreferences session
S_prefs = SCPreferencesCreate(NULL, CFSTR(MY_PLUGIN_NAME), NULL);
if (S_prefs == NULL) {
void
load_InterfaceNamer(CFBundleRef bundle, Boolean bundleVerbose)
{
+#pragma unused(bundleVerbose)
pthread_attr_t tattr;
pthread_t tid;
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>Requires</key>
<array>
<string>com.apple.SystemConfiguration.InterfaceNamer</string>
/*
- * Copyright (c) 2002-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
quality = ifr.ifr_link_quality_metric;
}
-done:
+ done:
+
interface_update_quality_metric(if_name, quality);
- if (sock != -1)
+
+ if (sock != -1) {
close(sock);
+ }
return;
}
link_update_status(const char *if_name, boolean_t attach, boolean_t only_if_different)
{
CFBooleanRef active = NULL;
- CFBooleanRef expensive;
+ CFBooleanRef expensive = NULL;
struct ifmediareq ifm;
int sock;
update:
- /* get "Expensive" */
- expensive = interface_update_expensive(if_name);
+ if ((active == NULL) || CFBooleanGetValue(active)) {
+ /*
+ * if link status not available or active (link UP),
+ * set "Expensive"
+ */
+ expensive = interface_update_expensive(if_name);
+ }
/* update status */
interface_update_status(if_name, active, attach, expensive, only_if_different);
{
#if defined(SIOCSIFEXPENSIVE) && !defined(MAIN)
struct ifreq ifr;
+ int ret;
bzero(&ifr, sizeof(ifr));
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_expensive = expensive;
- return (ioctl(s, SIOCSIFEXPENSIVE, &ifr));
+ ret = ioctl(s, SIOCSIFEXPENSIVE, &ifr);
+ if (ret == -1) {
+ SC_log(LOG_ERR, "%s: ioctl(SIOCSIFEXPENSIVE) failed: %s", name, strerror(errno));
+ }
+
+ return ret;
#else // defined(SIOCSIFEXPENSIVE) && !defined(MAIN)
return 0;
#endif // defined(SIOCSIFEXPENSIVE) && !defined(MAIN)
/*
- * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
SC_log(LOG_DEBUG, "Update interface configuration: %@: %@", key, newDict);
cache_SCDynamicStoreSetValue(store, key, newDict);
} else if (dict) {
- SC_log(LOG_DEBUG, "Update interface configuration: %@: <removed>", key);
+ CFDictionaryRef oldDict;
+
+ oldDict = cache_SCDynamicStoreCopyValue(store, key);
+ if (oldDict != NULL) {
+ SC_log(LOG_DEBUG, "Update interface configuration: %@: <removed>", key);
+ CFRelease(oldDict);
+ }
cache_SCDynamicStoreRemoveValue(store, key);
}
network_changed = TRUE;
/*
- * Copyright (c) 2002-2007, 2011, 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2007, 2011, 2013, 2015, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
CFArrayRef prefixLens;
CFMutableArrayRef newPrefixLens;
- register int byte;
+ register size_t byte;
register int bit;
int plen = 0;
SC_log(LOG_DEBUG, "Update interface configuration: %@: %@", key, newDict);
cache_SCDynamicStoreSetValue(store, key, newDict);
} else if (dict) {
- SC_log(LOG_DEBUG, "Update interface configuration: %@: <removed>", key);
+ CFDictionaryRef oldDict;
+
+ oldDict = cache_SCDynamicStoreCopyValue(store, key);
+ if (oldDict != NULL) {
+ SC_log(LOG_DEBUG, "Update interface configuration: %@: <removed>", key);
+ CFRelease(oldDict);
+ }
cache_SCDynamicStoreRemoveValue(store, key);
}
network_changed = TRUE;
CFRelease(prefix);
CFRelease(if_name_cf);
}
+
+__private_extern__
+void
+nat64_prefix_request(const char *if_name)
+{
+ CFStringRef if_name_cf;
+ CFStringRef key;
+
+ if_name_cf = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingASCII);
+ key = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
+ kSCDynamicStoreDomainState,
+ if_name_cf,
+ kSCEntNetNAT64PrefixRequest);
+ CFRelease(if_name_cf);
+ SC_log(LOG_DEBUG, "Post NAT64 prefix request: %@", key);
+ cache_SCDynamicStoreNotifyValue(store, key);
+ CFRelease(key);
+}
+
+__private_extern__ void
+ipv6_router_expired(const char *if_name)
+{
+ CFStringRef if_name_cf;
+ CFStringRef key;
+
+ if_name_cf = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingASCII);
+ key = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
+ kSCDynamicStoreDomainState,
+ if_name_cf,
+ kSCEntNetIPv6RouterExpired);
+ CFRelease(if_name_cf);
+ SC_log(LOG_DEBUG, "Post IPv6 Router Expired: %@", key);
+ cache_SCDynamicStoreNotifyValue(store, key);
+ CFRelease(key);
+}
/*
- * Copyright (c) 2002, 2004, 2011, 2012, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2011, 2012, 2015, 2017 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,
* 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@
*/
void interface_update_ipv6(struct ifaddrs *ifap, const char *if_name);
void ipv6_duplicated_address(const char * if_name, const struct in6_addr * addr,
int hw_len, const void * hw_addr);
+void nat64_prefix_request(const char *if_name);
+void ipv6_router_expired(const char *if_name);
+
__END_DECLS
#endif /* _EV_IPV6_H */
/*
- * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <sys/sysctl.h>
#include <sys/kern_event.h>
#include <network/config.h>
+#include <netinet6/nd6.h>
static dispatch_queue_t S_kev_queue;
static dispatch_source_t S_kev_source;
static void
logEvent(CFStringRef evStr, struct kern_event_msg *ev_msg)
{
- int i;
- int j;
+ int i;
+ uint32_t j;
if (!_verbose) {
return;
static void
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];
+ size_t dataLen = (ev_msg->total_size - KEV_MSG_HEADER_SIZE);
+ void * event_data = &ev_msg->event_data[0];
+ char ifr_name[IFNAMSIZ];
+ Boolean handled = TRUE;
switch (ev_msg->kev_subclass) {
case KEV_INET_SUBCLASS : {
case KEV_INET6_ADDR_DELETED :
case KEV_INET6_NEW_LL_ADDR :
case KEV_INET6_NEW_RTADV_ADDR :
- case KEV_INET6_DEFROUTER :
if (dataLen < sizeof(*ev)) {
handled = FALSE;
break;
}
break;
+ case KEV_INET6_REQUEST_NAT64_PREFIX :
+ if (dataLen < sizeof(*ev)) {
+ handled = FALSE;
+ break;
+ }
+ copy_if_name(&ev->link_data, ifr_name, sizeof(ifr_name));
+ SC_log(LOG_INFO, "Process NAT64 prefix request: %s", (char *)ifr_name);
+ nat64_prefix_request(ifr_name);
+ break;
+
default :
break;
}
}
copy_if_name(&protoEvent->link_data,
ifr_name, sizeof(ifr_name));
- SC_log(LOG_INFO, "Process protocol %s: %s (n=%d)",
+ SC_log(LOG_INFO, "Process protocol %s: %s (pf=%d, n=%d)",
(ev_msg->event_code == KEV_DL_PROTO_ATTACHED) ? "attach" : "detach",
(char *)ifr_name,
+ protoEvent->proto_family,
protoEvent->proto_remaining_count);
if (protoEvent->proto_remaining_count == 0) {
mark_if_down(ifr_name);
#ifdef KEV_ND6_SUBCLASS
case KEV_ND6_SUBCLASS : {
+ struct kev_nd6_event * ev;
+
+ ev = (struct kev_nd6_event *)event_data;
+ switch (ev_msg->event_code) {
+ case KEV_ND6_ADDR_DETACHED :
+ case KEV_ND6_ADDR_DEPRECATED :
+ case KEV_ND6_ADDR_EXPIRED :
+ if (dataLen < sizeof(*ev)) {
+ handled = FALSE;
+ break;
+ }
+ copy_if_name(&ev->link_data, ifr_name, sizeof(ifr_name));
+ SC_log(LOG_INFO, "Process ND6 address change: %s: %d", (char *)ifr_name, ev_msg->event_code);
+ interface_update_ipv6(NULL, ifr_name);
+ break;
+ case KEV_ND6_RTR_EXPIRED :
+ if (dataLen < sizeof(*ev)) {
+ handled = FALSE;
+ break;
+ }
+ copy_if_name(&ev->link_data, ifr_name, sizeof(ifr_name));
+ SC_log(LOG_INFO, "Process IPv6 router expired: %s: %d", (char *)ifr_name, ev_msg->event_code);
+ ipv6_router_expired(ifr_name);
+ break;
+ default :
+ break;
+ }
break;
}
#endif // KEV_ND6_SUBCLASS
static Boolean
eventCallback(int so)
{
- ssize_t status;
union {
char bytes[1024];
struct kern_event_msg ev_msg1; // first kernel event
} buf;
struct kern_event_msg *ev_msg = &buf.ev_msg1;
ssize_t offset = 0;
+ ssize_t status;
status = recv(so, &buf, sizeof(buf), 0);
if (status == -1) {
cache_open();
while (offset < status) {
- if ((offset + ev_msg->total_size) > status) {
+ if ((offset + (ssize_t)ev_msg->total_size) > status) {
SC_log(LOG_NOTICE, "missed SYSPROTO_EVENT event, buffer not big enough");
break;
}
static void
check_for_new_interfaces(void * context)
{
+#pragma unused(context)
static int count;
char msg[32];
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>Requires</key>
<array>
<string>com.apple.SystemConfiguration.InterfaceNamer</string>
/*
- * Copyright (c) 2002-2007, 2011, 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2007, 2011, 2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <net/if.h>
#include <net/if_media.h>
-#define SC_LOG_HANDLE __log_LinkConfiguration()
+#define SC_LOG_HANDLE __log_LinkConfiguration()
+#define SC_LOG_HANDLE_TYPE static
#include "SCNetworkConfigurationInternal.h"
#include <SystemConfiguration/SCDPlugin.h> // for _SCDPluginExecCommand
ret = ioctl(sock, SIOCSIFCAP, (caddr_t)&ifr);
(void)close(sock);
if (ret == -1) {
- SC_log(LOG_INFO, "ioctl(SIOCSIFCAP) failed: %s", strerror(errno));
+ SC_log(LOG_ERR, "%@: ioctl(SIOCSIFCAP) failed: %s", interfaceName, strerror(errno));
return FALSE;
}
#endif // SIOCSIFCAP
(void)_SC_cfstring_to_cstring(interfaceName, ifm.ifm_name, sizeof(ifm.ifm_name), kCFStringEncodingASCII);
if (ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifm) == -1) {
- SC_log(LOG_NOTICE, "ioctl(SIOCGIFMEDIA) failed: %s", strerror(errno));
+ SC_log(LOG_ERR, "%@: ioctl(SIOCGIFMEDIA) failed: %s", interfaceName, strerror(errno));
goto done;
}
SC_log(LOG_INFO, "new media settings: 0x%8.8x", ifr.ifr_media);
if (ioctl(sock, SIOCSIFMEDIA, (caddr_t)&ifr) == -1) {
- SC_log(LOG_NOTICE, "%@: ioctl(SIOCSIFMEDIA) failed: %s", interfaceName, strerror(errno));
+ SC_log(LOG_ERR, "%@: ioctl(SIOCSIFMEDIA) failed: %s", interfaceName, strerror(errno));
goto done;
}
static void
ifconfig_exit(pid_t pid, int status, struct rusage *rusage, void *context)
{
+#pragma unused(pid)
+#pragma unused(rusage)
char *if_name = (char *)context;
if (WIFEXITED(status)) {
ret = ioctl(sock, SIOCSIFMTU, (caddr_t)&ifr);
(void)close(sock);
if (ret == -1) {
- SC_log(LOG_NOTICE, "ioctl(SIOCSIFMTU) failed: %s", strerror(errno));
+ SC_log(LOG_ERR, "%@: ioctl(SIOCSIFMTU) failed: %s", interfaceName, strerror(errno));
ok = FALSE;
goto done;
}
static void
linkConfigChangedCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *arg)
{
+#pragma unused(arg)
os_activity_t activity;
CFDictionaryRef changes;
CFIndex i;
void
load_LinkConfiguration(CFBundleRef bundle, Boolean bundleVerbose)
{
+#pragma unused(bundleVerbose)
CFStringRef key;
CFMutableArrayRef keys = NULL;
Boolean ok;
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>Builtin</key>
<true/>
<key>Requires</key>
#include <unistd.h>
-#define SC_LOG_HANDLE __log_PreferencesMonitor()
+#define SC_LOG_HANDLE __log_PreferencesMonitor()
+#define SC_LOG_HANDLE_TYPE static
#include <SystemConfiguration/SystemConfiguration.h>
#include <SystemConfiguration/SCPrivate.h>
#include <SystemConfiguration/SCValidation.h>
}
if (!ok) {
- SC_log(LOG_NOTICE, "Could not establish network configuration: %s",
- SCErrorString(sc_status));
+ if (sc_status == kSCStatusOK) {
+ SC_log(LOG_NOTICE, "Network configuration not updated");
+ } else {
+ SC_log(LOG_NOTICE, "Could not establish network configuration: %s",
+ SCErrorString(sc_status));
+ }
}
(void)SCPreferencesUnlock(prefs);
}
-
-
static Boolean
previousConfigurationAvailable()
{
static void
storeCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
{
+#pragma unused(info)
CFDictionaryRef dict;
Boolean quiet = FALSE;
Boolean timeout = FALSE;
static void
updateCache(const void *key, const void *value, void *context)
{
+#pragma unused(context)
CFStringRef configKey = (CFStringRef)key;
CFPropertyListRef configData = (CFPropertyListRef)value;
CFPropertyListRef cacheData;
SCPreferencesNotification notificationType,
void *info)
{
+#pragma unused(info)
os_activity_t activity;
activity = os_activity_create("processing [SC] preferences.plist changes",
void
load_PreferencesMonitor(CFBundleRef bundle, Boolean bundleVerbose)
{
+#pragma unused(bundle)
+#pragma unused(bundleVerbose)
SC_log(LOG_DEBUG, "load() called");
SC_log(LOG_DEBUG, " bundle ID = %@", CFBundleGetIdentifier(bundle));
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>QoSMarking_AppleAudioVideoCalls_BundleIDs</key>
<array>
<string>com.apple.datausage.telephony.ims</string>
<string>com.apple.facetime</string>
<string>com.apple.siri</string>
</array>
- <key>QoSMarking_AppleAudioVideoCalls_ExecutablePaths</key>
- <array>
- <string>/usr/libexec/networkserviceproxy</string>
- </array>
<key>Requires</key>
<array>
<string>com.apple.SystemConfiguration.InterfaceNamer</string>
/*
- * Copyright (c) 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
bzero(&ifr, sizeof(ifr));
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(s, SIOCGIFTYPE, (caddr_t)&ifr) == -1) {
- SC_log(LOG_NOTICE, "%s: ioctl(SIOCGIFTYPE) failed: %m", ifname);
+ SC_log(LOG_NOTICE, "%s: ioctl(SIOCGIFTYPE) failed: %s",
+ ifname,
+ strerror(errno));
ifr.ifr_type.ift_type = 0;
ifr.ifr_type.ift_family = IFRTYPE_FAMILY_ANY;
ifr.ifr_type.ift_subfamily = IFRTYPE_SUBFAMILY_ANY;
}
+#if !TARGET_OS_IPHONE
+ if (ifr.ifr_type.ift_family == IFRTYPE_FAMILY_ETHERNET) {
+ return true;
+ }
+#else // !TARGET_OS_IPHONE
if ((ifr.ifr_type.ift_family == IFRTYPE_FAMILY_ETHERNET) &&
(ifr.ifr_type.ift_subfamily == IFRTYPE_SUBFAMILY_WIFI)) {
return true;
}
+#endif // !TARGET_OS_IPHONE
return false;
}
- (NEPolicySession *)createPolicySession
{
- NEPolicySession *session = nil;
-#if !TARGET_OS_IPHONE
- /*
- * Note: we cannot have entitlements on OSX so we open a kernel
- * control socket and use it to create a policy session
- */
-
- struct sockaddr_ctl kernctl_addr;
- struct ctl_info kernctl_info;
- int sock;
-
- // Create kernel control socket
- sock = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL);
- if (sock == -1) {
- SC_log(LOG_ERR, "socket() failed: %s", strerror(errno));
- return nil;
- }
-
- bzero(&kernctl_info, sizeof(kernctl_info));
- strlcpy(kernctl_info.ctl_name, NECP_CONTROL_NAME, sizeof(kernctl_info.ctl_name));
- if (ioctl(sock, CTLIOCGINFO, &kernctl_info)) {
- SC_log(LOG_ERR, "ioctl() failed: %s", strerror(errno));
- close(sock);
- return nil;
- }
-
- bzero(&kernctl_addr, sizeof(kernctl_addr));
- kernctl_addr.sc_len = sizeof(kernctl_addr);
- kernctl_addr.sc_family = AF_SYSTEM;
- kernctl_addr.ss_sysaddr = AF_SYS_CONTROL;
- kernctl_addr.sc_id = kernctl_info.ctl_id;
- kernctl_addr.sc_unit = 0;
- if (connect(sock, (struct sockaddr *)&kernctl_addr, sizeof(kernctl_addr))) {
- SC_log(LOG_ERR, "connect() failed: %s", strerror(errno));
- close(sock);
- return nil;
- }
-
- /* Create policy session */
- session = [[NEPolicySession alloc] initWithSocket:sock];
- if (session == nil) {
- close(sock);
- }
-
-#else // !TARGET_OS_IPHONE
- session = [[NEPolicySession alloc] init];
-#endif // !TARGET_OS_IPHONE
-
- return session;
+ return [[NEPolicySession alloc] init];
}
uuids = [NSMutableArray array];
xpc_array_apply(mapping, ^bool(size_t index, xpc_object_t value) {
+#pragma unused(index)
if ((value != NULL) &&
(xpc_get_type(value) == XPC_TYPE_UUID)) {
NSUUID * uuid;
static void
qosMarkingConfigChangedCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *arg)
{
+#pragma unused(arg)
os_activity_t activity;
CFDictionaryRef changes;
CFIndex n;
void
load_QoSMarking(CFBundleRef bundle, Boolean bundleVerbose)
{
+#pragma unused(bundleVerbose)
CFDictionaryRef dict;
CFStringRef key;
CFMutableArrayRef keys;
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.14</string>
+ <string>1.17</string>
</dict>
</plist>
/*
- * Copyright (c) 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static void
mirror(SCDynamicStoreRef store, CFArrayRef changes, void *info)
{
+#pragma unused(store)
CFDictionaryRef content_host;
CFDictionaryRef content_sim;
CFIndex i;
void
load_SimulatorSupport(CFBundleRef bundle, Boolean bundleVerbose)
{
+#pragma unused(bundleVerbose)
Boolean ok;
CFMutableDictionaryRef options;
CFRunLoopSourceRef rls;
/*
- * Copyright (c) 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
}
static void
-prefs_changed(__unused void * arg)
+prefs_changed(void * arg)
{
+#pragma unused(arg)
os_activity_t activity;
activity = os_activity_create("processing IPMonitor [rank] preference change",
static void
enable_prefs_observer(CFRunLoopRef runloop)
{
+#pragma unused(runloop)
return;
}
SCPreferencesNotification type,
void * info)
{
+#pragma unused(prefs)
+#pragma unused(type)
+#pragma unused(info)
prefs_changed(NULL);
return;
}
/*
- * Copyright (c) 2013 Apple Inc. All rights reserved.
+ * Copyright (c) 2013, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* @APPLE_LICENSE_HEADER_END@
*/
-#ifndef _EAP8021X_EAPOLCONTROLPREFS_H
-#define _EAP8021X_EAPOLCONTROLPREFS_H
+#ifndef _IPMONITORCONTROLPREFS_H
+#define _IPMONITORCONTROLPREFS_H
/*
* IPMonitorControlPrefs.h
Boolean
IPMonitorControlPrefsSetVerbose(Boolean verbose);
-#endif /* _COMMON_IPMONITORCONTROLPREFS_H */
+#endif /* _IPMONITORCONTROLPREFS_H */
#include <SystemConfiguration/scprefs_observer.h>
#include "InterfaceNamerControlPrefs.h"
-os_log_t __log_InterfaceNamer();
-
/*
* kInterfaceNamerControlPrefsID
* - identifies the InterfaceNamer preferences file that contains 'AllowNewInterfaces'
/*
- * Copyright (c) 2003, 2004, 2006, 2011, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2003, 2004, 2006, 2011, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
void
cache_SCDynamicStoreSetValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListRef value)
{
+#pragma unused(store)
CFIndex i;
i = CFArrayGetFirstIndexOfValue(cached_removals,
void
cache_SCDynamicStoreRemoveValue(SCDynamicStoreRef store, CFStringRef key)
{
+#pragma unused(store)
CFDictionaryRemoveValue(cached_set, key);
if (!CFArrayContainsValue(cached_removals,
void
cache_SCDynamicStoreNotifyValue(SCDynamicStoreRef store, CFStringRef key)
{
+#pragma unused(store)
if (!CFArrayContainsValue(cached_notifys,
CFRangeMake(0, CFArrayGetCount(cached_notifys)),
key)) {
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
#include <unistd.h>
#include <CoreFoundation/CoreFoundation.h>
-#define SC_LOG_HANDLE __log_SCMonitor()
+#define SC_LOG_HANDLE __log_SCMonitor()
+#define SC_LOG_HANDLE_TYPE static
#include <SystemConfiguration/SystemConfiguration.h>
#include <SystemConfiguration/SCPrivate.h>
static void
open_NetworkPrefPane(MyType *myInstance)
{
+#pragma unused(myInstance)
AEDesc aeDesc = { typeNull, NULL };
CFArrayRef prefArray;
CFURLRef prefURL;
CFStringRef message;
CFStringRef name;
-#define MESSAGE_1 "The \"%@\" network interface has not been set up. To set up this interface, use Network Preferences."
+#define MESSAGE_1 "The “%@” network interface has not been set up. To set up this interface, use Network Preferences."
format = CFBundleCopyLocalizedString(bundle,
CFSTR("MESSAGE_1"),
static void
update_lan(SCDynamicStoreRef store, CFArrayRef changes, void * arg)
{
+#pragma unused(store)
+#pragma unused(changes)
MyType *myInstance = (MyType *)arg;
updateInterfaceList(myInstance);
// watch for changes to the list of network interfaces
keys = CFArrayCreate(NULL, (const void **)&key, 1, &kCFTypeArrayCallBacks);
- SCDynamicStoreSetNotificationKeys(store, NULL, keys);
+ SCDynamicStoreSetNotificationKeys(store, keys, NULL);
CFRelease(keys);
myInstance->monitorRls = SCDynamicStoreCreateRunLoopSource(NULL, store, 0);
CFRunLoopAddSource(CFRunLoopGetCurrent(),
static void
update_node(void *refCon, io_service_t service, natural_t messageType, void *messageArgument)
{
+#pragma unused(messageArgument)
CFIndex i;
CFDataRef myData = (CFDataRef)refCon;
MyType *myInstance;
return;
}
- val = IORegistryEntryCreateCFProperty(service, CFSTR("Initializing"), NULL, 0);
+ val = IORegistryEntryCreateCFProperty(service, kSCNetworkInterfaceInitializingKey, NULL, 0);
if (val != NULL) {
initializing = (isA_CFBoolean(val) && CFBooleanGetValue(val));
CFRelease(val);
void *
UserEventAgentFactory(CFAllocatorRef allocator, CFUUIDRef typeID)
{
+#pragma unused(allocator)
MyType *newOne = NULL;
if (CFEqual(typeID, kUserEventAgentTypeID)) {
SCBondInterfaceRef
SCBondInterfaceCreate(SCPreferencesRef prefs)
{
- CFAllocatorRef allocator;
+ CFAllocatorRef allocator;
SCBondInterfaceRef bond = NULL;
CFIndex i;
static CFStringRef
__SCBondStatusCopyDescription(CFTypeRef cf)
{
- CFAllocatorRef allocator = CFGetAllocator(cf);
+ CFAllocatorRef allocator = CFGetAllocator(cf);
CFMutableStringRef result;
SCBondStatusPrivateRef statusPrivate = (SCBondStatusPrivateRef)cf;
static SCBondStatusRef
-__SCBondStatusCreatePrivate(CFAllocatorRef allocator,
- SCBondInterfaceRef bond,
- CFDictionaryRef status_bond,
- CFDictionaryRef status_interfaces)
+__SCBondStatusCreatePrivate(CFAllocatorRef __nullable allocator,
+ SCBondInterfaceRef bond,
+ CFDictionaryRef status_bond,
+ CFDictionaryRef status_interfaces)
{
SCBondStatusPrivateRef statusPrivate;
uint32_t size;
a_bond = CFArrayGetValueAtIndex(active, j);
a_bond_if = SCNetworkInterfaceGetBSDName(a_bond);
a_bond_interfaces = SCBondInterfaceGetMemberInterfaces(a_bond);
- a_bond_mode = SCBondInterfaceGetMode(a_bond);
+ a_bond_mode = SCBondInterfaceGetMode(a_bond);
a_count = (a_bond_interfaces != NULL) ? CFArrayGetCount(a_bond_interfaces) : 0;
if (CFEqual(c_bond_if, a_bond_if)) {
}
if (interface == NULL) {
interface = _SCNetworkInterfaceCreateWithBSDName(NULL, if_name,
- kIncludeNoVirtualInterfaces);
+ kIncludeNoVirtualInterfaces);
}
if (interface != NULL) {
// 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++) {
+ for (size_t i = 0; i < ibc_p->ifbic_len / sizeof(struct ifbreq); i++) {
struct ifbreq *ibr_p;
CFStringRef member;
return FALSE;
}
- if ((members != NULL) && !isA_CFArray(members)) {
- _SCErrorSet(kSCStatusInvalidArgument);
- return FALSE;
+ if (members != NULL) {
+ CFIndex n_members;
+
+ if (!isA_CFArray(members)) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return FALSE;
+ }
+
+ n_members = CFArrayGetCount(members);
+ for (CFIndex i = 0; i < n_members; i++) {
+ SCNetworkInterfaceRef member;
+ CFStringRef memberName;
+
+ member = CFArrayGetValueAtIndex(members, i);
+ if (!isA_SCNetworkInterface(member)) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return FALSE;
+ }
+
+ memberName = SCNetworkInterfaceGetBSDName(member);
+ if (memberName == NULL) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return FALSE;
+ }
+ }
}
if (interfacePrivate->prefs != NULL) {
CFArrayRef available;
CFArrayRef current;
- CFIndex i;
CFIndex n_available;
CFIndex n_current;
CFIndex n_members;
n_available = (available != NULL) ? CFArrayGetCount(available) : 0;
n_members = (members != NULL) ? CFArrayGetCount(members) : 0;
- for (i = 0; i < n_members; i++) {
+ for (CFIndex i = 0; i < n_members; i++) {
SCNetworkInterfaceRef member;
member = CFArrayGetValueAtIndex(members, i);
/*
- * Copyright (c) 2001, 2003-2005, 2011, 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2001, 2003-2005, 2011, 2013, 2015, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
Boolean
DHCPClientPreferencesSetApplicationOptions(CFStringRef applicationID,
- UInt8 * options,
+ const UInt8 * options,
CFIndex count)
{
CFMutableDictionaryRef dict = NULL;
/*
- * Copyright (c) 2001, 2004, 2005, 2008, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2001, 2004, 2005, 2008, 2015, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
Boolean
DHCPClientPreferencesSetApplicationOptions (CFStringRef applicationID,
- UInt8 * __nullable options,
+ const UInt8 * __nullable options,
CFIndex count) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
/*!
<key>CFBundleExecutable</key>
<string>SystemConfiguration</string>
<key>CFBundleGetInfoString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.14</string>
+ <string>1.17</string>
</dict>
</plist>
<key>CFBundleExecutable</key>
<string>SystemConfiguration</string>
<key>CFBundleGetInfoString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
- <string>1.14</string>
+ <string>1.17</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.14</string>
+ <string>1.17</string>
</dict>
</plist>
/*
- * Copyright (c) 2002-2007, 2010, 2011, 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2007, 2010, 2011, 2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static CFIndex
findCapability(CFStringRef capability)
{
- CFIndex i;
-
- for (i = 0; i < sizeof(capabilityMappings) / sizeof(capabilityMappings[0]); i++) {
+ for (size_t i = 0; i < sizeof(capabilityMappings) / sizeof(capabilityMappings[0]); i++) {
if (CFEqual(capability, *capabilityMappings[i].name)) {
return i;
}
{
int cap_available = 0;
int cap_current = capability_base;
- CFIndex i;
CFStringRef interfaceName;
if (!isA_SCNetworkInterface(interface)) {
goto done;
}
- for (i = 0; i < sizeof(capabilityMappings) / sizeof(capabilityMappings[0]); i++) {
+ for (size_t i = 0; i < sizeof(capabilityMappings) / sizeof(capabilityMappings[0]); i++) {
int cap_val;
CFTypeRef val;
int cap_current = 0;
int cap_available = 0;
int cap_val;
- CFIndex i;
CFStringRef interfaceName;
CFTypeRef val = NULL;
CFMutableDictionaryRef all = NULL;
// if ALL capabilities requested
- for (i = 0; i < sizeof(capabilityMappings) / sizeof(capabilityMappings[0]); i++) {
+ for (size_t i = 0; i < sizeof(capabilityMappings) / sizeof(capabilityMappings[0]); i++) {
if ((cap_available & capabilityMappings[i].val) == capabilityMappings[i].val) {
if (all == NULL) {
all = CFDictionaryCreateMutable(NULL,
val = all;
} else {
+ CFIndex i;
+
i = findCapability(capability);
if (i == kCFNotFound) {
// if unknown capability
/*
- * Copyright (c) 2000-2008, 2010-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008, 2010-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <servers/bootstrap.h>
-#include <asl.h>
#include <pthread.h>
#include <sys/time.h>
#include <os/log.h>
#include "SCD.h"
#include "config.h" /* MiG generated file */
-// asl logging
-#define INSTALL_FACILITY "install"
#define INSTALL_ENVIRONMENT "__OSINSTALL_ENVIRONMENT"
-// LIBASL SPI
-extern asl_object_t _asl_server_control_query(void);
-
/* framework variables */
int _sc_debug = FALSE; /* non-zero if debugging enabled */
int _sc_verbose = FALSE; /* non-zero if verbose logging enabled */
int _sc_log = TRUE; /* 0 if SC messages should be written to stdout/stderr,
- 1 if SC messages should be logged w/asl(3),
+ 1 if SC messages should be logged w/os_log(3),
2 if SC messages should be written to stdout/stderr AND logged */
__SCThreadSpecificDataRef tsd = (__SCThreadSpecificDataRef)arg;
if (tsd != NULL) {
- if (tsd->_asl != NULL) asl_release(tsd->_asl);
if (tsd->_sc_store != NULL) CFRelease(tsd->_sc_store);
CFAllocatorDeallocate(kCFAllocatorSystemDefault, tsd);
}
tsd = pthread_getspecific(tsDataKey);
if (tsd == NULL) {
tsd = CFAllocatorAllocate(kCFAllocatorSystemDefault, sizeof(__SCThreadSpecificData), 0);
- tsd->_asl = NULL;
tsd->_sc_error = kSCStatusOK;
tsd->_sc_store = NULL;
pthread_setspecific(tsDataKey, tsd);
};
static void
-__SCLog(asl_object_t asl, asl_object_t msg, int level, void *ret_addr, CFStringRef formatString, va_list formatArguments)
+__SCLog(void *ret_addr, os_log_type_t type, const char *formatString, va_list formatArguments)
{
- char *line;
- CFArrayRef lines;
- CFStringRef str;
-
- if ((asl == NULL) && (level >= 0)) {
- const char *__format;
-
- __format = CFStringGetCStringPtr(formatString, kCFStringEncodingUTF8);
- if (__format != NULL) {
- os_log_type_t __type;
-
- __type = _SC_syslog_os_log_mapping(level);
- os_log_with_args(_SC_LOG_DEFAULT(),
- __type,
- __format,
- formatArguments,
- ret_addr);
- return;
- }
- }
-
- if (asl == NULL) {
- __SCThreadSpecificDataRef tsd;
-
- tsd = __SCGetThreadSpecificData();
- if (tsd->_asl == NULL) {
- tsd->_asl = asl_open(NULL, (_SC_isInstallEnvironment() ? INSTALL_FACILITY : NULL), 0);
- asl_set_filter(tsd->_asl, ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG));
- }
- asl = tsd->_asl;
- }
-
-#ifdef ENABLE_SC_FORMATTING
- str = _CFStringCreateWithFormatAndArgumentsAux(NULL,
- _SCCopyDescription,
- NULL,
- formatString,
- formatArguments);
-#else /* ENABLE_SC_FORMATTING */
- str = CFStringCreateWithFormatAndArguments (NULL,
- NULL,
- formatString,
- formatArguments);
-#endif /* !ENABLE_SC_FORMATTING */
-
- if (level >= 0) {
- lines = CFStringCreateArrayBySeparatingStrings(NULL, str, CFSTR("\n"));
- if (lines != NULL) {
- CFIndex i;
- CFIndex n = CFArrayGetCount(lines);
-
- for (i = 0; i < n; i++) {
- line =_SC_cfstring_to_cstring_ext(CFArrayGetValueAtIndex(lines, i),
- NULL,
- 0,
- kCFStringEncodingUTF8,
- (UInt8)'?',
- NULL);
- asl_log(asl, msg, level, "%s", line);
- CFAllocatorDeallocate(NULL, line);
- }
- CFRelease(lines);
- }
- } else {
- line =_SC_cfstring_to_cstring_ext(str,
- NULL,
- 0,
- kCFStringEncodingUTF8,
- (UInt8)'?',
- NULL);
- asl_log(asl, msg, ~level, "%s", line);
- CFAllocatorDeallocate(NULL, line);
- }
- CFRelease(str);
+ os_log_with_args(_SC_LOG_DEFAULT(),
+ type,
+ formatString,
+ formatArguments,
+ ret_addr);
return;
}
}
-void
-SCLog(Boolean condition, int level, CFStringRef formatString, ...)
-{
- va_list formatArguments;
- va_list formatArguments_print;
- Boolean log = FALSE;
- Boolean print = FALSE;
-
- if (!condition) {
- return;
- }
-
- /*
- * 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, __builtin_return_address(0), formatString, formatArguments);
- va_end(formatArguments);
- }
-
- if (print) {
- __SCPrint((LOG_PRI(level) > LOG_NOTICE) ? stderr : stdout,
- formatString,
- formatArguments_print,
- (_sc_log > 0), // trace
- TRUE); // add newline
- va_end(formatArguments_print);
- }
-
- return;
-}
-
-
void
__SC_Log(int level, CFStringRef format_CF, os_log_t log, os_log_type_t type, const char *format, ...)
{
+#pragma unused(level)
Boolean do_log = FALSE;
Boolean do_print = FALSE;
va_list args_log;
* 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)
+ * 1 if SC messages should be logged w/os_log(3)
* 2 if SC messages should be written to stdout/stderr AND logged
*/
if (_sc_log > 0) {
- log = TRUE; // log requested
+ do_log = TRUE; // log requested
va_start(args_log, format);
if (_sc_log > 1) {
}
if (do_log) {
- if (level >= 0) {
- os_log_with_args(log,
- type,
- format,
- args_log,
- __builtin_return_address(0));
- } else {
- // if we need to break apart a multi-line message
- __SCLog(NULL,
- NULL,
- level,
- __builtin_return_address(0),
- format_CF,
- args_log);
- }
+ os_log_with_args(log,
+ type,
+ format,
+ args_log,
+ __builtin_return_address(0));
va_end(args_log);
}
}
return;
-
}
void
-SCLOG(asl_object_t asl, asl_object_t msg, int level, CFStringRef formatString, ...)
+SCLog(Boolean condition, int level, CFStringRef formatString, ...)
{
va_list formatArguments;
va_list formatArguments_print;
Boolean log = FALSE;
Boolean print = FALSE;
+ if (!condition) {
+ return;
+ }
+
/*
* 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)
+ * 1 if SC messages should be logged w/os_log(3)
* 2 if SC messages should be written to stdout/stderr AND logged
*/
}
if (log) {
- __SCLog(asl, msg, level, __builtin_return_address(0), formatString, formatArguments);
+ const char *__format;
+
+ __format = CFStringGetCStringPtr(formatString, kCFStringEncodingUTF8);
+ if (__format != NULL) {
+ os_log_type_t __type;
+
+ __type = _SC_syslog_os_log_mapping(level);
+ __SCLog(__builtin_return_address(0), __type, __format, formatArguments);
+ }
va_end(formatArguments);
}
if (print) {
- if (level < 0) {
- level = ~level;
- }
- __SCPrint((level > ASL_LEVEL_NOTICE) ? stderr : stdout,
+ __SCPrint((LOG_PRI(level) > LOG_NOTICE) ? stderr : stdout,
formatString,
formatArguments_print,
(_sc_log > 0), // trace
}
-#pragma mark -
-#pragma mark ASL Functions
-
-
-static CFTypeID __kSCLoggerTypeID = _kCFRuntimeNotATypeID;
-
-typedef enum {
- kModuleStatusEnabled,
- kModuleStatusDisabled,
- kModuleStatusDoesNotExist
-} ModuleStatus;
-
-struct SCLogger
-{
- CFRuntimeBase cf_base;
-
- char * loggerID; // LoggerID
- SCLoggerFlags flags;
- asl_object_t aslc;
- asl_object_t aslm;
- ModuleStatus module_status;
- pthread_mutex_t lock;
-};
-
-
-static void __SCLoggerDeallocate(CFTypeRef cf);
-static const CFRuntimeClass __SCLoggerClass = {
- 0, /* version */
- "SCLogger", /* className */
- NULL, /* init */
- NULL, /* copy */
- __SCLoggerDeallocate, /* deallocate */
- NULL, /* equal */
- NULL, /* hash */
- NULL, /* copyFormattingDesc */
- NULL /* copyDebugDesc */
-};
-
-
-#define DATETIMEBUFFERSIZE 32
-
-
-static pthread_once_t registerLoggerOnce = PTHREAD_ONCE_INIT;
-static pthread_once_t defaultLoggerOnce = PTHREAD_ONCE_INIT;
-
-typedef enum {
- kLoggerASLControlEnableModule,
- kLoggerASLControlDisableModule,
- kLoggerASLControlLogFileCheckpoint
-} LoggerASLControl;
-
-static SCLoggerRef defaultLogger = NULL;
-static SCLoggerRef __SCLoggerCreate(void);
-static void __SCLoggerDefaultLoggerInit();
-static SCLoggerRef SCLoggerGetDefaultLogger();
-static void SCLoggerSetLoggerID(SCLoggerRef logger, CFStringRef loggerID);
-static void SCLoggerSendMessageToModuleOnly(SCLoggerRef logger, Boolean isPrivate);
-static void SCLoggerSendASLControl(SCLoggerRef logger, LoggerASLControl control);
-static ModuleStatus GetModuleStatus(const char * loggerID);
-
-static void
-__SCLoggerRegisterClass(void)
-{
- if (__kSCLoggerTypeID == _kCFRuntimeNotATypeID) {
- __kSCLoggerTypeID = _CFRuntimeRegisterClass(&__SCLoggerClass);
- }
- return;
-}
-
-static SCLoggerRef
-__SCLoggerAllocate(CFAllocatorRef allocator)
-{
- SCLoggerRef state;
- int size;
-
- pthread_once(®isterLoggerOnce, __SCLoggerRegisterClass);
-
- size = sizeof(*state) - sizeof(CFRuntimeBase);
- state = (SCLoggerRef) _CFRuntimeCreateInstance(allocator,
- __kSCLoggerTypeID,
- size,
- NULL);
- return (state);
-}
-
-static void
-__SCLoggerDeallocate(CFTypeRef cf)
-{
- SCLoggerRef logger = (SCLoggerRef)cf;
-
- if (logger != NULL) {
- // Rotate on close behavior
- if (logger->module_status != kModuleStatusDoesNotExist) {
- SCLoggerSendASLControl(logger,
- kLoggerASLControlLogFileCheckpoint);
- }
- if (logger->loggerID != NULL) {
- CFAllocatorDeallocate(NULL, logger->loggerID);
- logger->loggerID = NULL;
- }
- if (logger->aslm != NULL) {
- asl_release(logger->aslm);
- logger->aslm = NULL;
- }
- if (logger->aslc != NULL) {
- asl_release(logger->aslc);
- logger->aslc = NULL;
- }
- }
-}
-
-static SCLoggerRef
-__SCLoggerCreate(void)
-{
- SCLoggerRef tempLogger = NULL;
-
- tempLogger = __SCLoggerAllocate(kCFAllocatorDefault);
- tempLogger->loggerID = NULL;
- tempLogger->flags = kSCLoggerFlagsDefault;
- tempLogger->aslc = asl_open(NULL, (_SC_isInstallEnvironment() ? INSTALL_FACILITY : NULL), ASL_OPT_NO_DELAY);
- tempLogger->aslm = asl_new(ASL_TYPE_MSG);
- pthread_mutex_init(&(tempLogger->lock), NULL);
- tempLogger->module_status = kModuleStatusDoesNotExist;
-
- return tempLogger;
-}
-
-SCLoggerFlags
-SCLoggerGetFlags(SCLoggerRef logger)
-{
- return logger->flags;
-}
-
-void
-SCLoggerSetFlags(SCLoggerRef logger, SCLoggerFlags flags)
-{
- if (logger == defaultLogger) {
- return;
- }
- pthread_mutex_lock(&(logger->lock));
- if (flags != kSCLoggerFlagsNone) {
- logger->module_status = GetModuleStatus(logger->loggerID);
- if (logger->module_status == kModuleStatusDoesNotExist) {
- goto done;
- }
- if ((flags & kSCLoggerFlagsFile) != 0) {
- if ((logger->flags & kSCLoggerFlagsFile) == 0) {
- // Enable the module if disabled
- if (logger->module_status == kModuleStatusDisabled) {
- SCLoggerSendASLControl(logger, kLoggerASLControlEnableModule);
- }
- // Setting ASL Filter level to debug
- asl_set_filter(logger->aslc, ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG));
- if (logger->loggerID != NULL) {
- asl_set(logger->aslm, kLoggerID,
- logger->loggerID);
- }
- }
- }
- else if ((logger->flags & kSCLoggerFlagsFile) != 0) {
- asl_unset(logger->aslm, kLoggerID);
- asl_set_filter(logger->aslc, ASL_FILTER_MASK_UPTO(ASL_LEVEL_NOTICE));
- SCLoggerSendMessageToModuleOnly(logger, false);
- }
- if ((flags & kSCLoggerFlagsDefault) != 0) {
- if ((logger->flags & kSCLoggerFlagsDefault) == 0) {
- SCLoggerSendMessageToModuleOnly(logger, false);
- }
- }
- else if ((logger->flags & kSCLoggerFlagsDefault) != 0) {
- SCLoggerSendMessageToModuleOnly(logger, true);
- }
- }
- logger->flags = flags;
- done:
- pthread_mutex_unlock(&(logger->lock));
-}
-
-
-static void
-SCLoggerSetLoggerID(SCLoggerRef logger, CFStringRef loggerID)
-{
- logger->loggerID
- = _SC_cfstring_to_cstring(loggerID, NULL, 0,
- kCFStringEncodingUTF8);
- // Enable the module if disabled
- logger->module_status = GetModuleStatus(logger->loggerID);
- if (logger->module_status == kModuleStatusDisabled) {
- SCLoggerSendASLControl(logger, kLoggerASLControlEnableModule);
- }
-}
-
-static ModuleStatus
-GetModuleStatus(const char * loggerID)
-{
- ModuleStatus moduleStatus = kModuleStatusDoesNotExist;
- asl_object_t response = NULL;
- const char* value = NULL;
-
- if (loggerID != NULL) {
- response = _asl_server_control_query();
- if (response == NULL) {
- goto done;
- }
- value = asl_get(response, loggerID);
- if (value == NULL) {
- moduleStatus = kModuleStatusDoesNotExist;
- goto done;
- }
-
- if (strcmp(value, "enabled") == 0) {
- moduleStatus = kModuleStatusEnabled;
- }
- else {
- moduleStatus = kModuleStatusDisabled;
- }
- }
-done:
- asl_release(response);
-
- return moduleStatus;
-}
-
-static void
-SCLoggerSendMessageToModuleOnly(SCLoggerRef logger, Boolean isPrivate)
-{
- if (isPrivate) {
- asl_set(logger->aslm, kASLModule, logger->loggerID);
- }
- else {
- if (asl_get(logger->aslm, kASLModule) != NULL) {
- asl_unset(logger->aslm, kASLModule);
- }
- }
-}
-
-static void
-SCLoggerSendASLControl(SCLoggerRef logger, LoggerASLControl control)
-{
- SCLoggerRef defLogger = SCLoggerGetDefaultLogger();
- pthread_mutex_lock(&(defLogger->lock));
-
- // this next line turns the asl_log()'s that follow into control messages
- asl_set(defLogger->aslm, kASLOption, "control");
-
- switch (control) {
- case kLoggerASLControlEnableModule:
- asl_log(defLogger->aslc, defLogger->aslm,
- ASL_LEVEL_NOTICE, "@ %s enable 1",
- logger->loggerID);
- break;
- case kLoggerASLControlDisableModule:
- asl_log(defLogger->aslc, defLogger->aslm,
- ASL_LEVEL_NOTICE, "@ %s enable 0",
- logger->loggerID);
- break;
- case kLoggerASLControlLogFileCheckpoint:
- asl_log(defLogger->aslc, defLogger->aslm,
- ASL_LEVEL_NOTICE, "@ %s checkpoint",
- logger->loggerID);
- break;
- default:
- break;
- }
-
- // turn off control mode
- asl_unset(defLogger->aslm, kASLOption);
- pthread_mutex_unlock(&defLogger->lock);
- return;
-}
-
-SCLoggerRef
-SCLoggerCreate(CFStringRef loggerID)
-{
- SCLoggerRef logger = NULL;
-
- logger = __SCLoggerCreate();
- if (loggerID != NULL) {
- SCLoggerSetLoggerID(logger, loggerID);
- }
- SCLoggerSetFlags(logger, kSCLoggerFlagsDefault);
- return logger;
-}
-
-static void
-__SCLoggerDefaultLoggerInit()
-{
- if (defaultLogger == NULL) {
- defaultLogger = __SCLoggerCreate();
- defaultLogger->flags = kSCLoggerFlagsDefault;
- }
-}
-
-static SCLoggerRef
-SCLoggerGetDefaultLogger()
-{
- pthread_once(&defaultLoggerOnce, __SCLoggerDefaultLoggerInit);
- return defaultLogger;
-}
-
-static void
-SCLoggerVLogInternal(SCLoggerRef logger, int loglevel, void *ret_addr,
- CFStringRef formatString, va_list args)
-{
- asl_object_t aslc;
- asl_object_t aslm;
-
- if (logger == NULL
- || logger->module_status == kModuleStatusDoesNotExist) {
- logger = SCLoggerGetDefaultLogger();
- }
- pthread_mutex_lock(&(logger->lock));
- if (logger->flags == kSCLoggerFlagsNone) {
- pthread_mutex_unlock(&(logger->lock));
- return;
- }
- aslc = logger->aslc;
- aslm = logger->aslm;
- __SCLog(aslc, aslm, loglevel, ret_addr, formatString, args);
- pthread_mutex_unlock(&(logger->lock));
- return;
-}
-
-void
-SCLoggerLog(SCLoggerRef logger, int loglevel, CFStringRef formatString, ...)
-{
- va_list args;
-
- va_start(args, formatString);
- SCLoggerVLogInternal(logger, loglevel, __builtin_return_address(0), formatString, args);
- va_end(args);
-
- return;
-}
-
-void
-SCLoggerVLog(SCLoggerRef logger, int loglevel, CFStringRef formatString, va_list args)
-{
- SCLoggerVLogInternal(logger, loglevel, __builtin_return_address(0), formatString, args);
- return;
-}
-
-
#pragma mark -
#pragma mark SC error handling / logging
/*
- * Copyright (c) 2011, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2011, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <Availability.h>
#include <TargetConditionals.h>
#include <sys/cdefs.h>
-#include <asl.h>
#include <SystemConfiguration/SCDynamicStore.h>
typedef struct {
- aslclient _asl;
int _sc_error;
SCDynamicStoreRef _sc_store;
} __SCThreadSpecificData, *__SCThreadSpecificDataRef;
/*
- * Copyright (c) 2000-2005, 2009-2011, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009-2011, 2013, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return FALSE;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
return FALSE;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000-2005, 2009-2011, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009-2011, 2013, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
}
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
return NULL;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000-2008, 2011, 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008, 2011, 2013-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
Boolean
_SC_stringIsValidDNSName(const char *name)
{
- int i;
+ size_t i;
size_t len = strlen(name);
char prev = '\0';
const char *scan;
/*
- * Copyright (c) 2000-2005, 2009-2011, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009-2011, 2013, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return NULL;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000-2005, 2009-2011, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009-2011, 2013, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return FALSE;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000-2005, 2008-2011, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2008-2011, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
Boolean
SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
{
+#ifdef VERBOSE_ACTIVITY_LOGGING
struct os_activity_scope_state_s activity_state;
+#endif // VERBOSE_ACTIVITY_LOGGING
SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store;
kern_return_t status;
int sc_status;
goto done;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope_enter(storePrivate->activity, &activity_state);
+#endif // VERBOSE_ACTIVITY_LOGGING
status = notifycancel(storePrivate->server, (int *)&sc_status);
sc_status = kSCStatusOK;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope_leave(&activity_state);
+#endif // VERBOSE_ACTIVITY_LOGGING
done :
/*
- * Copyright (c) 2000, 2001, 2003-2005, 2009-2011, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2009-2011, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return NULL;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000-2005, 2008-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2008-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static void
rlsCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
{
+#pragma unused(size)
mach_no_senders_notification_t *buf = msg;
mach_msg_id_t msgid = buf->not_header.msgh_id;
SCDynamicStoreRef store = (SCDynamicStoreRef)info;
bzero(&opts, sizeof(opts));
opts.flags = MPO_CONTEXT_AS_GUARD|MPO_INSERT_SEND_RIGHT;
- kr = mach_port_construct(mach_task_self(), &opts, store, &port);
+ kr = mach_port_construct(mach_task_self(), &opts, (mach_port_context_t)store, &port);
#else // HAVE_MACHPORT_GUARDS
kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port);
#endif // HAVE_MACHPORT_GUARDS
SC_log(LOG_DEBUG, " establish notification request with SCDynamicStore server");
#endif /* DEBUG */
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/* remove our receive right */
#ifdef HAVE_MACHPORT_GUARDS
- (void) mach_port_destruct(mach_task_self(), port, 0, store);
+ (void) mach_port_destruct(mach_task_self(), port, 0, (mach_port_context_t)store);
#else // HAVE_MACHPORT_GUARDS
(void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1);
#endif // HAVE_MACHPORT_GUARDS
if (sc_status != kSCStatusOK) {
/* something [else] didn't work, remove our receive right */
#ifdef HAVE_MACHPORT_GUARDS
- (void) mach_port_destruct(mach_task_self(), port, 0, store);
+ (void) mach_port_destruct(mach_task_self(), port, 0, (mach_port_context_t)store);
#else // HAVE_MACHPORT_GUARDS
(void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1);
#endif // HAVE_MACHPORT_GUARDS
/* and, finally, remove our receive right */
#ifdef HAVE_MACHPORT_GUARDS
- (void) mach_port_destruct(mach_task_self(), mp, 0, store);
+ (void) mach_port_destruct(mach_task_self(), mp, 0, (mach_port_context_t)store);
#else // HAVE_MACHPORT_GUARDS
(void) mach_port_mod_refs(mach_task_self(), mp, MACH_PORT_RIGHT_RECEIVE, -1);
#endif // HAVE_MACHPORT_GUARDS
SC_log(LOG_DEBUG, " cancel notification request with SCDynamicStore server");
#endif /* DEBUG */
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
if (storePrivate->server != MACH_PORT_NULL) {
kr = notifycancel(storePrivate->server, (int *)&sc_status);
/*
- * Copyright (c) 2000, 2001, 2003-2005, 2008-2011, 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2008-2011, 2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
int32_t identifier,
int *fd)
{
+#ifdef VERBOSE_ACTIVITY_LOGGING
struct os_activity_scope_state_s activity_state;
+#endif // VERBOSE_ACTIVITY_LOGGING
int fildes[2] = { -1, -1 };
fileport_t fileport = MACH_PORT_NULL;
int ret;
goto fail;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope_enter(storePrivate->activity, &activity_state);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
goto retry;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope_leave(&activity_state);
+#endif // VERBOSE_ACTIVITY_LOGGING
if (status != KERN_SUCCESS) {
_SCErrorSet(status);
/*
- * Copyright (c) 2000, 2001, 2004, 2005, 2009-2011, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009-2011, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return FALSE;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000-2005, 2009-2011, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009-2011, 2013, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return FALSE;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000, 2001, 2003-2005, 2009-2011, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2009-2011, 2013, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
}
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000, 2001, 2004, 2006, 2009-2011, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2006, 2009-2011, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
SC_log(LOG_NOTICE, "oldNotify != MACH_PORT_NULL");
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
return FALSE;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
// something changed, cancelling notification request
status = notifycancel(storePrivate->server,
/*
- * Copyright (c) 2000-2005, 2009-2011, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009-2011, 2013, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return FALSE;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000-2006, 2008-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2008-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
if (storePrivate->name != NULL) CFRelease(storePrivate->name);
if (storePrivate->options != NULL) CFRelease(storePrivate->options);
+#ifdef VERBOSE_ACTIVITY_LOGGING
/* release activity tracing */
if (storePrivate->activity != NULL) os_release(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
return;
}
static mach_port_t
__SCDynamicStoreServerPort(SCDynamicStorePrivateRef storePrivate, kern_return_t *status)
{
+#pragma unused(storePrivate)
mach_port_t server = MACH_PORT_NULL;
char *server_name;
/* client side of the "configd" session */
storePrivate->name = (name != NULL) ? CFRetain(name) : NULL;
+#ifdef VERBOSE_ACTIVITY_LOGGING
/* "client" activity tracing */
storePrivate->activity = os_activity_create("accessing SCDynamicStore",
OS_ACTIVITY_CURRENT,
OS_ACTIVITY_FLAG_DEFAULT);
+#endif // VERBOSE_ACTIVITY_LOGGING
/* Notification status */
storePrivate->notifyStatus = NotifierNotRegistered;
static Boolean
__SCDynamicStoreAddSession(SCDynamicStorePrivateRef storePrivate)
{
+#ifdef VERBOSE_ACTIVITY_LOGGING
struct os_activity_scope_state_s activity_state;
+#endif // VERBOSE_ACTIVITY_LOGGING
kern_return_t kr = KERN_SUCCESS;
CFDataRef myName; /* serialized name */
xmlData_t myNameRef;
updateServerPort(storePrivate, &server, &sc_status);
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope_enter(storePrivate->activity, &activity_state);
+#endif // VERBOSE_ACTIVITY_LOGGING
while (server != MACH_PORT_NULL) {
// if SCDynamicStore server available
storePrivate->server = server;
sc_status = kSCStatusOK;
} else {
+ if (kr == KERN_INVALID_RIGHT) {
+ // We can get KERN_INVALID_RIGHT if the server dies and we try to
+ // add a send right to a stale (now dead) port name
+ kr = MACH_SEND_INVALID_DEST;
+ }
storePrivate->server = MACH_PORT_NULL;
}
} else {
}
__MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreAddSession", storePrivate->server);
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope_leave(&activity_state);
+#endif // VERBOSE_ACTIVITY_LOGGING
// clean up
CFRelease(myName);
sc_status = kSCStatusNoStoreServer;
break;
default :
- SC_log((kr == KERN_SUCCESS) ? LOG_INFO : LOG_ERR, "configopen() failed: %s",
+ SC_log((kr == KERN_SUCCESS) ? LOG_INFO : LOG_ERR, "configopen() failed: %d: %s",
+ sc_status,
SCErrorString(sc_status));
break;
}
if (__SCDynamicStoreReconnect(store)) {
/* retry needed */
return TRUE;
+ } else {
+ status = SCError();
}
} else {
/* an unexpected error, leave the [session] port alone */
return __kSCDynamicStoreTypeID;
}
+
Boolean
SCDynamicStoreSetDisconnectCallBack(SCDynamicStoreRef store,
SCDynamicStoreDisconnectCallBack callout)
/*
- * Copyright (c) 2002-2006, 2013, 2015 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2006, 2013, 2015, 2017 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static void
reaper(int sigraised)
{
+#pragma unused(sigraised)
/*
* block additional SIGCHLD's until current children have
* been reaped.
static void
childrenReaped(CFMachPortRef port, void *msg, CFIndex size, void *info)
{
+#pragma unused(port)
+#pragma unused(msg)
+#pragma unused(size)
+#pragma unused(info)
pid_t pid = 0;
childInfoRef reapedChildren = NULL;
static CFStringRef
childReapedMPCopyDescription(const void *info)
{
+#pragma unused(info)
return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SIGCHLD MP>"));
}
/*
- * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
size_t n;
n = strlen(buf);
- if ((n+IF_NAMESIZE+1) <= (int)bufLen) {
+ if ((n+IF_NAMESIZE+1) <= bufLen) {
buf[n++] = '%';
if_indextoname(addr.sin6->sin6_scope_id, &buf[n]);
}
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);
- }
+ 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);
}
+/*
+ * cachedInfo
+ * <dict>
+ * <key>bundleID-tableName</key>
+ * <dict>
+ * ... property list from non-localized bundle URL
+ * </dict>
+ * </dict>
+ */
+static CFMutableDictionaryRef cachedInfo = NULL;
+
+
+static dispatch_queue_t
+_SC_CFBundleCachedInfoQueue()
+{
+ static dispatch_once_t once;
+ static dispatch_queue_t q;
+
+ dispatch_once(&once, ^{
+ q = dispatch_queue_create("_SC_CFBundleCachedInfo", NULL);
+ });
+
+ return q;
+}
+
+
+static CFStringRef
+_SC_CFBundleCachedInfoCopyTableKey(CFBundleRef bundle, CFStringRef tableName)
+{
+ CFStringRef bundleID;
+ CFStringRef tableKey;
+
+ bundleID = CFBundleGetIdentifier(bundle);
+ tableKey = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@: %@"), bundleID, tableName);
+ return tableKey;
+}
+
+
+static CFDictionaryRef
+_SC_CFBundleCachedInfoCopyTable(CFBundleRef bundle, CFStringRef tableName)
+{
+ __block CFDictionaryRef dict = NULL;
+
+ dispatch_sync(_SC_CFBundleCachedInfoQueue(), ^{
+ if (cachedInfo != NULL) {
+ CFStringRef tableKey;
+
+ tableKey = _SC_CFBundleCachedInfoCopyTableKey(bundle, tableName);
+ dict = CFDictionaryGetValue(cachedInfo, tableKey);
+ if (dict != NULL) {
+ CFRetain(dict);
+ }
+ CFRelease(tableKey);
+ }
+ });
+
+ return dict;
+}
+
+
+static void
+_SC_CFBundleCachedInfoSaveTable(CFBundleRef bundle, CFStringRef tableName, CFDictionaryRef table)
+{
+
+ dispatch_sync(_SC_CFBundleCachedInfoQueue(), ^{
+ CFStringRef tableKey;
+
+ tableKey = _SC_CFBundleCachedInfoCopyTableKey(bundle, tableName);
+ SC_log(LOG_DEBUG, "Caching %@", tableKey);
+
+ if (cachedInfo == NULL) {
+ cachedInfo = CFDictionaryCreateMutable(NULL,
+ 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ }
+ CFDictionarySetValue(cachedInfo, tableKey, table);
+ CFRelease(tableKey);
+ });
+
+ return;
+}
+
+
CFStringRef
_SC_CFBundleCopyNonLocalizedString(CFBundleRef bundle, CFStringRef key, CFStringRef value, CFStringRef tableName)
{
- CFURLRef resourcesURL;
CFStringRef str = NULL;
CFDictionaryRef table = NULL;
CFURLRef url;
tableName = CFSTR("Localizable");
}
- /*
- * First, try getting the requested string using a manually constructed
- * URL to <bundle>/Resources/English.lproj/<tableName>.strings. Do this
- * because CFBundleCopyResourceURLForLocalization() uses CFPreferences
- * to get the preferred localizations, CFPreferences talks to
- * OpenDirectory, and OpenDirectory tries to obtain the platform UUID.
- * On machines where the platform UUID is set by InterfaceNamer, a
- * deadlock can occur if InterfaceNamer calls
- * CFBundleCopyResourceURLForLocalization() before setting the
- * platform UUID in the kernel.
- */
- resourcesURL = CFBundleCopyResourcesDirectoryURL(bundle);
- if (resourcesURL != NULL) {
- CFURLRef en_lproj;
- CFStringRef fileName;
-
- en_lproj = CFURLCreateCopyAppendingPathComponent(NULL,
- resourcesURL,
- CFSTR("English.lproj"),
- TRUE);
- fileName = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@.strings"), tableName);
- url = CFURLCreateCopyAppendingPathComponent(NULL, en_lproj, fileName, FALSE);
- CFRelease(en_lproj);
- CFRelease(fileName);
- CFRelease(resourcesURL);
-
- table = _SCCreatePropertyListFromResource(url);
- CFRelease(url);
- }
-
+ table = _SC_CFBundleCachedInfoCopyTable(bundle, tableName);
if (table == NULL) {
url = CFBundleCopyResourceURLForLocalization(bundle,
tableName,
if (url != NULL) {
table = _SCCreatePropertyListFromResource(url);
CFRelease(url);
+ if (table != NULL) {
+ _SC_CFBundleCachedInfoSaveTable(bundle, tableName, table);
+ }
} else {
SC_log(LOG_ERR, "failed to get resource url: {bundle:%@, table: %@}", bundle, tableName);
}
}
-void
-_SC_logMachPortReferences(const char *str, mach_port_t port)
+__private_extern__
+kern_return_t
+_SC_getMachPortReferences(mach_port_t port,
+ mach_port_type_t *pt,
+ mach_port_urefs_t *refs_send,
+ mach_port_urefs_t *refs_recv,
+ mach_port_status_t *recv_status,
+ mach_port_urefs_t *refs_once,
+ mach_port_urefs_t *refs_pset,
+ mach_port_urefs_t *refs_dead,
+ const char *err_prefix)
{
- const char *blanks = " ";
- char buf[60];
- mach_port_type_t pt;
- mach_port_status_t recv_status = { 0 };
- mach_port_urefs_t refs_send = 0;
- mach_port_urefs_t refs_recv = 0;
- mach_port_urefs_t refs_once = 0;
- mach_port_urefs_t refs_pset = 0;
- mach_port_urefs_t refs_dead = 0;
kern_return_t status;
- buf[0] = '\0';
- if (str != NULL) {
- static int is_configd = -1;
-
- if (is_configd == -1) {
- is_configd = (strcmp(getprogname(), _SC_SERVER_PROG) == 0);
- }
- if (is_configd == 1) {
- // if "configd", add indication if this is the M[ain] or [P]lugin thread
- strlcpy(buf,
- (CFRunLoopGetMain() == CFRunLoopGetCurrent()) ? "M " : "P ",
- sizeof(buf));
- }
-
- // add provided string
- strlcat(buf, str, sizeof(buf));
-
- // fill
- strlcat(buf, blanks, sizeof(buf));
- if (strcmp(&buf[sizeof(buf) - 3], " ") == 0) {
- buf[sizeof(buf) - 3] = ':';
- }
- }
-
- status = mach_port_type(mach_task_self(), port, &pt);
+ status = mach_port_type(mach_task_self(), port, pt);
if (status != KERN_SUCCESS) {
SC_log(LOG_DEBUG, "%smach_port_type(..., 0x%x): %s",
- buf,
+ err_prefix,
port,
mach_error_string(status));
- return;
+ return status;
}
- if ((pt & MACH_PORT_TYPE_SEND) != 0) {
- status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND, &refs_send);
+ if ((refs_send != NULL) && ((*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) {
SC_log(LOG_DEBUG, "%smach_port_get_refs(..., 0x%x, MACH_PORT_RIGHT_SEND): %s",
- buf,
+ err_prefix,
port,
mach_error_string(status));
- return;
+ return status;
}
}
- if ((pt & MACH_PORT_TYPE_RECEIVE) != 0) {
+ if ((refs_recv != NULL) && (recv_status != NULL) && ((*pt & MACH_PORT_TYPE_RECEIVE) != 0)) {
mach_msg_type_number_t count;
- status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, &refs_recv);
+ status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, refs_recv);
if (status != KERN_SUCCESS) {
SC_log(LOG_DEBUG, "%smach_port_get_refs(..., 0x%x, MACH_PORT_RIGHT_RECEIVE): %s",
- buf,
+ err_prefix,
port,
mach_error_string(status));
- return;
+ return status;
}
count = MACH_PORT_RECEIVE_STATUS_COUNT;
status = mach_port_get_attributes(mach_task_self(),
port,
MACH_PORT_RECEIVE_STATUS,
- (mach_port_info_t)&recv_status,
+ (mach_port_info_t)recv_status,
&count);
if (status != KERN_SUCCESS) {
SC_log(LOG_DEBUG, "%smach_port_get_attributes(..., 0x%x, MACH_PORT_RECEIVE_STATUS): %s",
- buf,
+ err_prefix,
port,
mach_error_string(status));
- return;
+ return status;
}
}
- 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 ((refs_once != NULL) && ((*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) {
SC_log(LOG_DEBUG, "%smach_port_get_refs(..., 0x%x, MACH_PORT_RIGHT_SEND_ONCE): %s",
- buf,
+ err_prefix,
port,
mach_error_string(status));
- return;
+ return status;
}
}
- 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 ((refs_pset != NULL) && ((*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) {
SC_log(LOG_DEBUG, "%smach_port_get_refs(..., 0x%x, MACH_PORT_RIGHT_PORT_SET): %s",
- buf,
+ err_prefix,
port,
mach_error_string(status));
- return;
+ return status;
}
}
- if ((pt & MACH_PORT_TYPE_DEAD_NAME) != 0) {
- status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_DEAD_NAME, &refs_dead);
+ if ((refs_dead != NULL) && ((*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) {
SC_log(LOG_DEBUG, "%smach_port_get_refs(..., 0x%x, MACH_PORT_RIGHT_DEAD_NAME): %s",
- buf,
+ err_prefix,
port,
mach_error_string(status));
- return;
+ return status;
+ }
+ }
+
+ return KERN_SUCCESS;
+}
+
+
+void
+_SC_logMachPortReferences(const char *str, mach_port_t port)
+{
+ const char *blanks = " ";
+ char buf[60];
+ mach_port_type_t pt;
+ mach_port_status_t recv_status = { .mps_nsrequest = 0, };
+ mach_port_urefs_t refs_send = 0;
+ mach_port_urefs_t refs_recv = 0;
+ mach_port_urefs_t refs_once = 0;
+ mach_port_urefs_t refs_pset = 0;
+ mach_port_urefs_t refs_dead = 0;
+ kern_return_t status;
+
+ buf[0] = '\0';
+ if (str != NULL) {
+ static int is_configd = -1;
+
+ if (is_configd == -1) {
+ is_configd = (strcmp(getprogname(), _SC_SERVER_PROG) == 0);
}
+ if (is_configd == 1) {
+ // if "configd", add indication if this is the M[ain] or [P]lugin thread
+ strlcpy(buf,
+ (CFRunLoopGetMain() == CFRunLoopGetCurrent()) ? "M " : "P ",
+ sizeof(buf));
+ }
+
+ // add provided string
+ strlcat(buf, str, sizeof(buf));
+
+ // fill
+ strlcat(buf, blanks, sizeof(buf));
+ if (strcmp(&buf[sizeof(buf) - 3], " ") == 0) {
+ buf[sizeof(buf) - 3] = ':';
+ }
+ }
+
+ status = _SC_getMachPortReferences(port,
+ &pt,
+ &refs_send,
+ &refs_recv,
+ &recv_status,
+ &refs_once,
+ &refs_pset,
+ &refs_dead,
+ buf);
+ if (status != KERN_SUCCESS) {
+ return;
}
SC_log(LOG_DEBUG, "%smach port 0x%x (%d): send=%d, receive=%d, send once=%d, port set=%d, dead name=%d%s%s",
static Boolean
_SC_SimulateCrash(const char *crash_info, CFStringRef notifyHeader, CFStringRef notifyMessage)
{
+#if !TARGET_OS_EMBEDDED || defined(DO_NOT_INFORM)
+#pragma unused(notifyHeader)
+#pragma unused(notifyMessage)
+#endif // !TARGET_OS_EMBEDDED || defined(DO_NOT_INFORM)
+#if TARGET_OS_SIMULATOR
+#pragma unused(crash_info)
+#endif // TARGET_OS_SIMULATOR
Boolean ok = FALSE;
#if !TARGET_OS_SIMULATOR
/*
- * Copyright (c) 2000-2005, 2009-2011, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009-2011, 2013, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return FALSE;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000-2006, 2009-2011, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2009-2011, 2013, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
}
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
return FALSE;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000, 2001, 2004, 2005, 2009-2011, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009-2011, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return FALSE;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope(storePrivate->activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
retry :
/*
- * Copyright (c) 2000-2004, 2006, 2009-2011, 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2009-2011, 2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <mach/mach.h>
#include <pthread.h>
#include <regex.h>
+#ifdef VERBOSE_ACTIVITY_LOGGING
#include <os/activity.h>
+#endif // VERBOSE_ACTIVITY_LOGGING
#include <os/log.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFRuntime.h>
CFStringRef name;
CFDictionaryRef options;
+#ifdef VERBOSE_ACTIVITY_LOGGING
/* activity tracing */
os_activity_t activity;
+#endif // VERBOSE_ACTIVITY_LOGGING
/* server side of the "configd" session */
mach_port_t server;
/*
- * Copyright (c) 2002, 2004, 2006, 2010, 2011, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2006, 2010, 2011, 2015, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
CFStringRef
SCDynamicStoreKeyCreateLocation(CFAllocatorRef allocator)
{
+#pragma unused(allocator)
return CFRetain(kSCDynamicStoreDomainSetup);
}
CFStringRef path;
uint64_t entryID;
CFMutableDictionaryRef overrides;
- Boolean modemIsV92;
CFStringRef prefix;
CFNumberRef type;
CFNumberRef unit;
#pragma mark SCNetworkInterface configuration (internal)
Boolean
-__SCNetworkInterfaceMatchesName (CFStringRef name, CFStringRef key);
+__SCNetworkInterfaceMatchesName (CFStringRef name,
+ CFStringRef key);
CFArrayRef
__SCNetworkInterfaceCopyAll_IONetworkInterface (Boolean keep_pre_configured);
You must release the returned value.
*/
CFDictionaryRef
-__SCNetworkInterfaceCopyStorageEntity (SCNetworkInterfaceRef interface);
+__SCNetworkInterfaceCopyStorageEntity (SCNetworkInterfaceRef interface);
/*!
@function __SCNetworkInterfaceCopyStoredWithPreferences
*/
CFArrayRef // SCNetworkInterfaceRef
-__SCNetworkInterfaceCopyStoredWithPreferences (SCPreferencesRef ni_prefs);
+__SCNetworkInterfaceCopyStoredWithPreferences (SCPreferencesRef ni_prefs);
SCNetworkInterfacePrivateRef
__SCNetworkInterfaceCreateCopy (CFAllocatorRef allocator,
@function __SCNetworkInterfaceCreateMappingUsingBSDName
@discussion This function creates mapping of BSD name and network interface using
preferences which point to the NetworkInterfaces.plist file.
- @param ni_prefs Preferences pointing to NetworkInterfaces.plist
+ @param interfaces An array of network interfaces to use for the mapping.
@result BSD Mapping in a dictionary.
You must release the returned value.
*/
CFDictionaryRef
-__SCNetworkInterfaceCreateMappingUsingBSDName(CFArrayRef interfaces);
+__SCNetworkInterfaceCreateMappingUsingBSDName (CFArrayRef interfaces);
SCNetworkInterfaceRef
__SCNetworkInterfaceCreateWithNIPreferencesUsingBSDName(CFAllocatorRef allocator,
__SCBridgeInterfaceSetMemberInterfaces (SCBridgeInterfaceRef bridge,
CFArrayRef members);
+void
+_SCNetworkInterfaceCacheOpen();
+
+void
+_SCNetworkInterfaceCacheClose();
+
#pragma mark -
#pragma mark SCNetworkProtocol configuration (internal)
/*
- * Copyright (c) 2005-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
@function _SCNetworkInterfaceCopyActive
@discussion Creates an SCNetworkInterface and associated with interface name
and SCDynamicStoreRef
- @param the interface name
- @param the SCDynamicStoreRef
+ @param store The SCDynamicStoreRef
+ @param bsdName The interface name
@result the SCNetworkInterface
*/
SCNetworkInterfaceRef
/*!
@function SCNetworkInterfaceGetPrimaryRank
@discussion We allow caller to retrieve the rank on an interface.
- @param the interface to get the rank
+ @param interface The interface to get the rank
@result SCNetworkServicePrimaryRank
*/
SCNetworkServicePrimaryRank
@discussion We allow caller to set an assertion on an interface.
The rank assertion lives as long as the SCNetworkInterfaceRef
remains valid.
- @param the interface to set the rank assertion
- @param the new rank to be set
+ @param interface The interface to set the rank assertion
+ @param newRank The new rank to be set
@result TRUE if operation is successful; FALSE if an error was encountered.
*/
Boolean
Boolean
_SCNetworkInterfaceIsHiddenConfiguration (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
-/*!
- @function _SCNetworkInterfaceIsModemV92
- @discussion Identifies if a modem network interface supports
- v.92 (hold).
- @param interface The network interface.
- @result TRUE if the interface is "v.92" modem.
- */
-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).
CFDictionaryRef
-SCNetworkInterfaceGetQoSMarkingPolicy (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_12,__IPHONE_10_0);
+SCNetworkInterfaceGetQoSMarkingPolicy (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_10_0);
Boolean
SCNetworkInterfaceSetQoSMarkingPolicy (SCNetworkInterfaceRef interface,
- CFDictionaryRef policy) __OSX_AVAILABLE_STARTING(__MAC_10_12,__IPHONE_10_0);
+ CFDictionaryRef policy) __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_10_0);
#pragma mark -
return (isA_CFType(obj, SCNetworkProtocolGetTypeID()));
}
+/*!
+ @function _SCNetworkProtocolCompare
+ @discussion Compares two SCNetworkProtocol objects.
+ @param val1 The SCNetworkProtocol object.
+ @param val2 The SCNetworkProtocol object.
+ @param context Not used.
+ @result A comparison result.
+ */
+CFComparisonResult
+_SCNetworkProtocolCompare (const void *val1,
+ const void *val2,
+ void *context) __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
+
#pragma mark -
#pragma mark SCNetworkService configuration (SPI)
API in that queries and operations interact with the "active" service
represented in the SCDynamicStore. Only a limited subset of the
SCNetworkService APIs are supported.
- @param prefs The dynamic store session.
+ @param store The dynamic store session.
@param serviceID The unique identifier for the service.
@result A reference to the SCNetworkService represented in the SCDynamicStore;
NULL if the serviceID does not exist in the SCDynamicStore or if an
}
+/*!
+ @function _SCNetworkSetCompare
+ @discussion Compares two SCNetworkSet objects.
+ @param val1 The SCNetworkSet object.
+ @param val2 The SCNetworkSet object.
+ @param context Not used.
+ @result A comparison result.
+ */
+CFComparisonResult
+_SCNetworkSetCompare (const void *val1,
+ const void *val2,
+ void *context) __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0);
+
/*!
@function SCNetworkSetCopyAvailableInterfaces
@discussion Returns all available interfaces for the set.
CF_RETURNS_RETAINED
CFArrayRef
-_SCNetworkConfigurationPerformMigration(CFURLRef sourceDir,
- CFURLRef currentDir,
- CFURLRef targetDir,
- CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0);
+_SCNetworkConfigurationPerformMigration (CFURLRef sourceDir,
+ CFURLRef currentDir,
+ CFURLRef targetDir,
+ CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0);
/*!
*/
Boolean
-_SCNetworkConfigurationCheckValidity(CFURLRef configDir,
- CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0);
+_SCNetworkConfigurationCheckValidity (CFURLRef configDir,
+ CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0);
/*!
*/
Boolean
-_SCNetworkConfigurationCheckValidityWithPreferences (SCPreferencesRef prefs,
- SCPreferencesRef ni_prefs,
- CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
+_SCNetworkConfigurationCheckValidityWithPreferences
+ (SCPreferencesRef prefs,
+ SCPreferencesRef ni_prefs,
+ CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
/*!
@function _SCNetworkMigrationAreConfigurationsIdentical
@discussion Compares the migration output between network configurations
with the expected output.
- @param configPref Preferences pointing toward preferences.plist file to
- be compared with expected file.
- @param configNetworkInterfacePref Preferences pointing toward NetworkInterfaces.plist
- file to be compared with expected file.
- @param expectedConfigPref Preferences pointing toward preferences.plist file
- which is the expected result.
- @param expectedNetworkInterfacePref Preferences pointing toward NetworkInterfaces.plist
- file which is the expected file.
+ @param configurationURL A URL pointing to the top-level directory of the
+ configuration to compare. This directory is expected to have
+ a Library/Preferences/SystemConfiguration subdirectoy.
+ @param expectedConfigurationURL A URL pointing to the top-level directory of
+ the expected configuration. This directory is expected to have
+ a Library/Preferences/SystemConfiguration subdirectoy.
@result TRUE if configurations match with the expected configurations
*/
Boolean
-_SCNetworkMigrationAreConfigurationsIdentical (CFURLRef configurationURL,
- CFURLRef expectedConfigurationURL)
- __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0);
+_SCNetworkMigrationAreConfigurationsIdentical (CFURLRef configurationURL,
+ CFURLRef expectedConfigurationURL) __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0);
/*!
@function _SCNetworkConfigurationCopyMigrationRemovePaths
/*
- * Copyright (c) 2003-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* In that case, we try to get the service type/subtype from the dynamic store.
*/
if (!result && SCError() == kSCStatusInvalidArgument) {
- CFStringRef interfaceKey = SCDynamicStoreKeyCreateNetworkServiceEntity(kCFAllocatorDefault,
- kSCDynamicStoreDomainSetup,
- SCNetworkServiceGetServiceID(connectionPrivate->service),
- kSCEntNetInterface);
- CFDictionaryRef interfaceDict = SCDynamicStoreCopyValue(NULL, interfaceKey);
+ CFStringRef interfaceKey;
+ CFDictionaryRef interfaceDict;
+ CFStringRef serviceID;
+
+ serviceID = SCNetworkServiceGetServiceID(connectionPrivate->service);
+ interfaceKey = SCDynamicStoreKeyCreateNetworkServiceEntity(kCFAllocatorDefault,
+ kSCDynamicStoreDomainSetup,
+ serviceID,
+ kSCEntNetInterface);
+ interfaceDict = SCDynamicStoreCopyValue(NULL, interfaceKey);
if (isA_CFDictionary(interfaceDict)) {
CFStringRef interfaceType = CFDictionaryGetValue(interfaceDict, kSCPropNetInterfaceType);
if (isA_CFString(interfaceType)) {
#if !TARGET_OS_SIMULATOR
return (connectionPrivate->ne_session != NULL);
#else
+#pragma unused(connectionPrivate)
return FALSE;
#endif /* !TARGET_OS_SIMULATOR */
}
void (*context_release)(const void *),
void *context_info)
{
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_t activity;
- activity = os_activity_create("processing SCHelper request",
+ activity = os_activity_create("processing SCNetworkConnection notification",
OS_ACTIVITY_CURRENT,
OS_ACTIVITY_FLAG_DEFAULT);
os_activity_scope(activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
SC_log(LOG_DEBUG, "exec SCNetworkConnection callout");
(*rlsFunction)(connection, nc_status, context_info);
if ((context_release != NULL) && (context_info != NULL)) {
(*context_release)(context_info);
}
+
+#ifdef VERBOSE_ACTIVITY_LOGGING
os_release(activity);
+#endif // VERBOSE_ACTIVITY_LOGGING
return;
}
static void
__SCNetworkConnectionMachCallBack(CFMachPortRef port, void * msg, CFIndex size, void * info)
{
+#pragma unused(port)
+#pragma unused(size)
mach_no_senders_notification_t *buf = msg;
mach_msg_id_t msgid = buf->not_header.msgh_id;
SCNetworkConnectionRef connection = (SCNetworkConnectionRef)info;
CFStringRef runLoopMode,
dispatch_queue_t queue)
{
+#pragma unused(queue)
SCNetworkConnectionPrivateRef connectionPrivate = (SCNetworkConnectionPrivateRef)connection;
dispatch_group_t drainGroup = NULL;
dispatch_queue_t drainQueue = NULL;
dispatch_retain(wait_for_session);
ne_session_set_event_handler(new_session, __SCNetworkConnectionQueue(),
^(ne_session_event_t event, void *event_data) {
+#pragma unused(event_data)
os_activity_t activity;
activity = os_activity_create("processing ne_session notification",
int
-SCNetworkConnectionGetServiceIdentifier (SCNetworkConnectionRef connection)
+SCNetworkConnectionGetServiceIdentifier (SCNetworkConnectionRef connection)
{
SCNetworkConnectionPrivateRef connectionPrivate = (SCNetworkConnectionPrivateRef)connection;
int service_identifier = -1;
CFDictionaryRef result = NULL;
int sc_status = kSCStatusOK;
CFArrayRef triggers;
- uint64_t triggersCount = 0;
- int triggersIndex;
+ CFIndex triggersCount = 0;
Boolean usedOnDemandRetry = FALSE;
if (triggerNow != NULL) {
triggers = CFDictionaryGetValue(configuration, kSCNetworkConnectionOnDemandTriggers);
triggersCount = isA_CFArray(triggers) ? CFArrayGetCount(triggers) : 0;
- for (triggersIndex = 0; triggersIndex < triggersCount; triggersIndex++) {
+ for (CFIndex triggersIndex = 0; triggersIndex < triggersCount; triggersIndex++) {
CFStringRef matched_domain = NULL;
CFStringRef matched_probe_string = NULL;
CFDictionaryRef trigger;
CFStringRef service_id)
{
CFArrayRef triggers;
- uint64_t triggersCount = 0;
- int triggersIndex;
+ CFIndex triggersCount;
triggers = CFDictionaryGetValue(configuration, kSCNetworkConnectionOnDemandTriggers);
triggersCount = isA_CFArray(triggers) ? CFArrayGetCount(triggers) : 0;
- for (triggersIndex = 0; triggersIndex < triggersCount; triggersIndex++) {
+ for (CFIndex triggersIndex = 0; triggersIndex < triggersCount; triggersIndex++) {
CFDictionaryRef trigger;
CFStringRef trigger_service_id;
SCNetworkConnectionStatus *connectionStatus,
CFStringRef *vpnRemoteAddress) /* CFDictionaryRef *info */
{
+#pragma unused(storeP)
CFDictionaryRef configuration;
Boolean ok = FALSE;
int sc_status = kSCStatusOK;
void
__SCNetworkConnectionMaskIPv6Address(struct in6_addr *addr, struct in6_addr *mask)
{
- int i;
-
- for (i = 0; i < sizeof(struct in6_addr); i++)
+ for (size_t i = 0; i < sizeof(struct in6_addr); i++)
addr->s6_addr[i] &= mask->s6_addr[i];
}
return password;
#else // !TARGET_OS_IPHONE
+#pragma unused(uniqueID)
return NULL;
#endif // !TARGET_OS_IPHONE
}
/*
- * Copyright (c) 2006-2012, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2012, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
void *context2,
void *context3)
{
+#pragma unused(serviceID)
+#pragma unused(context2)
+#pragma unused(context3)
CFStringRef matchID = (CFStringRef)context1;
if (current == NULL) {
void *context2,
void *context3)
{
+#pragma unused(serviceID)
+#pragma unused(context2)
+#pragma unused(context3)
CFStringRef matchID = (CFStringRef)context1;
CFMutableDictionaryRef newDict;
void *context2,
void *context3)
{
+#pragma unused(serviceID)
+#pragma unused(context2)
+#pragma unused(context3)
CFStringRef matchID = (CFStringRef)context1;
CFStringRef *name = (CFStringRef *)context3;
void *context2,
void *context3)
{
+#pragma unused(serviceID)
+#pragma unused(context2)
+#pragma unused(context3)
CFStringRef matchID = (CFStringRef)context1;
CFMutableDictionaryRef newDict;
CFStringRef newName = (CFStringRef)context2;
void *context2,
void *context3)
{
+#pragma unused(serviceID)
CFDictionaryRef *dict = (CFDictionaryRef *)context3;
CFStringRef interfaceType = (CFStringRef)context2;
CFStringRef matchID = (CFStringRef)context1;
static CF_RETURNS_RETAINED CFDictionaryRef
setInterfaceConfigurationCallout(CFStringRef serviceID,
- CFDictionaryRef current,
- void *context1,
- void *context2,
- void *context3)
+ CFDictionaryRef current,
+ void *context1,
+ void *context2,
+ void *context3)
{
+#pragma unused(serviceID)
CFStringRef interfaceType = (CFStringRef)context2;
CFStringRef matchID = (CFStringRef)context1;
CFMutableDictionaryRef newDict;
void *context2,
void *context3)
{
+#pragma unused(context1)
+#pragma unused(context2)
CFMutableArrayRef *prefs = (CFMutableArrayRef *)context3;
CFStringRef prefsID;
SCUserPreferencesPrivateRef userPrivate;
void *context2,
void *context3)
{
+#pragma unused(context1)
+#pragma unused(context2)
CFBooleanRef isDefault;
CFStringRef prefsID;
SCUserPreferencesPrivateRef *userPrivate = (SCUserPreferencesPrivateRef *)context3;
void *context2,
void *context3)
{
+#pragma unused(serviceID)
+#pragma unused(context2)
+#pragma unused(context3)
CFMutableDictionaryRef newDict;
CFStringRef newPrefsID = (CFStringRef)context1;
void *context2,
void *context3)
{
+#pragma unused(serviceID)
+#pragma unused(context2)
CFStringRef matchID = (CFStringRef)context1;
CFMutableDictionaryRef *userOptions = (CFMutableDictionaryRef *)context3;
#include "dy_framework.h"
-#ifndef kIODeviceSupportsHoldKey
-#define kIODeviceSupportsHoldKey "V92Modem"
-#endif
-
#ifndef kPCIThunderboltString
#define kPCIThunderboltString "PCI-Thunderbolt"
#endif
static void __SCNetworkInterfaceDeallocate (CFTypeRef cf);
static Boolean __SCNetworkInterfaceEqual (CFTypeRef cf1, CFTypeRef cf2);
static CFHashCode __SCNetworkInterfaceHash (CFTypeRef cf);
+static void __SCNetworkInterfaceCacheAdd (CFStringRef bsdName, CFArrayRef matchingInterfaces);
+static Boolean __SCNetworkInterfaceCacheIsOpen ();
+static CFArrayRef __SCNetworkInterfaceCacheCopy (CFStringRef bsdName);
enum {
static CFMutableSetRef vendor_interface_types = NULL;
+// A thread-specific convenience cache of all interfaces matching a bsd name
+// Key: CFStringRef (BSD name)
+// Value: CFArrayRef (matching interfaces)
+static __thread CFMutableDictionaryRef S_interface_cache = NULL;
+
#pragma mark -
#pragma mark SCNetworkInterface configuration details
if (interfacePrivate->hidden) {
CFStringAppendFormat(result, NULL, CFSTR(", hidden = TRUE"));
}
- if (interfacePrivate->modemIsV92) {
- CFStringAppendFormat(result, NULL, CFSTR(", v.92"));
- }
if (interfacePrivate->location != NULL) {
CFStringAppendFormat(result, NULL, CFSTR(", location = %@"), interfacePrivate->location);
}
CFComparisonResult
_SCNetworkInterfaceCompare(const void *val1, const void *val2, void *context)
{
+#pragma unused(context)
SCNetworkInterfacePrivateRef dev1 = (SCNetworkInterfacePrivateRef)val1;
SCNetworkInterfacePrivateRef dev2 = (SCNetworkInterfacePrivateRef)val2;
CFComparisonResult res = kCFCompareEqualTo;
slot_name = IORegistryEntryCreateCFProperty(interface, CFSTR("AAPL,slot-name"), NULL, 0);
if (slot_name != NULL) {
- CFIndex i;
-
slot = CFStringCreateMutable(NULL, 0);
if (isA_CFString(slot_name)) {
if (pci_slot_name != NULL) *pci_slot_name = CFStringCreateCopy(NULL, slot_name);
kCFStringEncodingUTF8);
}
- for (i = 0; i < sizeof(slot_prefixes)/sizeof(slot_prefixes[0]); i++) {
+ for (size_t i = 0; i < sizeof(slot_prefixes)/sizeof(slot_prefixes[0]); i++) {
CFIndex len;
len = CFStringGetLength(slot_prefixes[i]);
}
}
- for (i = 0; i < sizeof(slot_mappings)/sizeof(slot_mappings[0]); i++) {
+ for (size_t i = 0; i < sizeof(slot_mappings)/sizeof(slot_mappings[0]); i++) {
if (CFStringCompare(slot,
slot_mappings[i].name,
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
static CFComparisonResult
compare_bsdNames(const void *val1, const void *val2, void *context)
{
+#pragma unused(context)
CFStringRef bsd1 = (CFStringRef)val1;
CFStringRef bsd2 = (CFStringRef)val2;
io_registry_entry_t bus,
CFDictionaryRef bus_dict)
{
+#if TARGET_OS_SIMULATOR
+#pragma unused(interfacePrivate)
+#pragma unused(interface)
+#endif // TARGET_OS_SIMULATOR
+#pragma unused(interface_dict)
+#pragma unused(controller)
+#pragma unused(controller_dict)
+#pragma unused(bus)
+#pragma unused(bus_dict)
#if !TARGET_OS_SIMULATOR
// capture USB info
if (interfacePrivate->usb.name == NULL) {
// Modem
interfacePrivate->interface_type = kSCNetworkInterfaceTypeModem;
interfacePrivate->sort_order = kSortModem;
-
- // V.92 support
- val = IORegistryEntrySearchCFProperty(interface,
- kIOServicePlane,
- CFSTR(kIODeviceSupportsHoldKey),
- NULL,
- kIORegistryIterateRecursively | kIORegistryIterateParents);
- if (val != NULL) {
- uint32_t v92;
-
- if (isA_CFNumber(val) &&
- CFNumberGetValue(val, kCFNumberSInt32Type, &v92)) {
- interfacePrivate->modemIsV92 = (v92 == 1);
- }
- CFRelease(val);
- }
}
// Entity (Type)
static CFIndex
findConfiguration(CFStringRef interface_type)
{
- CFIndex i;
-
- for (i = 0; i < sizeof(configurations)/sizeof(configurations[0]); i++) {
+ for (size_t i = 0; i < sizeof(configurations)/sizeof(configurations[0]); i++) {
if (CFEqual(interface_type, *configurations[i].interface_type)) {
return i;
}
static void
__addExtendedConfigurationType(const void *key, const void *value, void *context)
{
+#pragma unused(value)
CFStringRef extendedType = (CFStringRef)key;
extendedConfigurationRef myContextRef = (extendedConfigurationRef)context;
kSCPropUserDefinedName,
SCNetworkInterfaceGetLocalizedDisplayName(interface));
- // note that this is a V.92 capable modem
- if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeModem) &&
- interfacePrivate->modemIsV92) {
- int one = 1;
- CFNumberRef num;
-
- num = CFNumberCreate(NULL, kCFNumberIntType, &one);
- CFDictionarySetValue(entity,
- kSCPropNetInterfaceSupportsModemOnHold,
- num);
- CFRelease(num);
- }
-
return entity;
}
SCNetworkInterfaceRef
-_SCNetworkInterfaceCreateWithBSDName(CFAllocatorRef allocator,
- CFStringRef bsdName,
- UInt32 flags)
+_SCNetworkInterfaceCreateWithBSDName(CFAllocatorRef allocator,
+ CFStringRef bsdName,
+ UInt32 flags)
{
+#pragma unused(allocator)
CFMutableDictionaryRef entity = NULL;
struct ifreq ifr;
SCNetworkInterfaceRef interface;
static SCNetworkInterfaceRef
-__SCNetworkInterfaceCreateWithStorageEntity (CFAllocatorRef allocator,
- CFDictionaryRef interface_entity,
- SCPreferencesRef prefs)
+__SCNetworkInterfaceCreateWithStorageEntity(CFAllocatorRef allocator,
+ CFDictionaryRef interface_entity)
{
+#pragma unused(allocator)
SCNetworkInterfacePrivateRef interfacePrivate = NULL;
CFBooleanRef active = NULL;
CFStringRef bsdName = NULL;
}
+void
+_SCNetworkInterfaceCacheOpen()
+{
+ if (!__SCNetworkInterfaceCacheIsOpen()) {
+ S_interface_cache = CFDictionaryCreateMutable(NULL,
+ 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ SC_log(LOG_DEBUG, "SCNetworkInterface cache (%p): open", S_interface_cache);
+ }
+}
+
+
+void
+_SCNetworkInterfaceCacheClose()
+{
+ if (__SCNetworkInterfaceCacheIsOpen()) {
+ SC_log(LOG_DEBUG, "SCNetworkInterface cache (%p): close", S_interface_cache);
+ CFRelease(S_interface_cache);
+ S_interface_cache = NULL;
+ }
+}
+
+
+static void
+__SCNetworkInterfaceCacheAdd(CFStringRef bsdName, CFArrayRef matchingInterfaces)
+{
+ if (__SCNetworkInterfaceCacheIsOpen() &&
+ bsdName != NULL &&
+ matchingInterfaces != NULL) {
+ SC_log(LOG_DEBUG, "SCNetworkInterface cache (%p): add %@", S_interface_cache, bsdName);
+ CFDictionaryAddValue(S_interface_cache, bsdName, matchingInterfaces);
+ }
+}
+
+
+static inline Boolean
+__SCNetworkInterfaceCacheIsOpen()
+{
+ return (S_interface_cache != NULL);
+}
+
+
+static CFArrayRef
+__SCNetworkInterfaceCacheCopy(CFStringRef bsdName)
+{
+ if (__SCNetworkInterfaceCacheIsOpen() &&
+ bsdName != NULL) {
+ CFArrayRef matchingInterfaces = CFDictionaryGetValue(S_interface_cache, bsdName);
+ if (matchingInterfaces) {
+ CFRetain(matchingInterfaces);
+ SC_log(LOG_DEBUG, "SCNetworkInterface cache (%p): copy w/ match for %@", S_interface_cache, bsdName);
+ } else {
+ SC_log(LOG_DEBUG, "SCNetworkInterface cache (%p): copy w/ no match for %@", S_interface_cache, bsdName);
+ }
+
+ return matchingInterfaces;
+ }
+
+ return NULL;
+}
+
+
SCNetworkInterfaceRef
-_SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator,
- CFDictionaryRef interface_entity,
- SCNetworkServiceRef service)
+_SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator,
+ CFDictionaryRef interface_entity,
+ SCNetworkServiceRef service)
{
+#pragma unused(allocator)
SCNetworkInterfacePrivateRef interfacePrivate = NULL;
CFStringRef ifDevice;
CFStringRef ifName = NULL;
if (service != NULL) {
servicePref = ((SCNetworkServicePrivateRef)service)->prefs;
useSystemInterfaces = ((__SCPreferencesUsingDefaultPrefs(servicePref)) &&
- (__SCPreferencesGetLimitSCNetworkConfiguration(servicePref) == FALSE));
+ (!__SCPreferencesGetLimitSCNetworkConfiguration(servicePref)));
}
ifType = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceType);
goto done;
}
if (useSystemInterfaces) {
- if (_SC_cfstring_to_cstring(ifDevice, bsdName, sizeof(bsdName), kCFStringEncodingASCII) == NULL) {
- goto done;
- }
+ // Check to see if we already have the info in the cache
+ matching_interfaces = __SCNetworkInterfaceCacheCopy(ifDevice);
+ if (matching_interfaces == NULL) {
+ if (_SC_cfstring_to_cstring(ifDevice, bsdName, sizeof(bsdName), kCFStringEncodingASCII) == NULL) {
+ goto done;
+ }
- matching = IOBSDNameMatching(masterPort, 0, bsdName);
- if (matching == NULL) {
- goto done;
+ matching = IOBSDNameMatching(masterPort, 0, bsdName);
+ if (matching == NULL) {
+ goto done;
+ }
+ matching_interfaces = findMatchingInterfaces(matching,
+ processNetworkInterface,
+ kSCNetworkInterfaceHiddenInterfaceKey,
+ TRUE);
+
+ __SCNetworkInterfaceCacheAdd(ifDevice, matching_interfaces);
+ CFRelease(matching);
}
- matching_interfaces = findMatchingInterfaces(matching,
- processNetworkInterface,
- kSCNetworkInterfaceHiddenInterfaceKey,
- TRUE);
- CFRelease(matching);
}
} else if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPSerial)) {
#if !TARGET_OS_IPHONE
static void
-addBTPANInterface(SCPreferencesRef prefs, CFMutableArrayRef all_interfaces)
+addBTPANInterface(CFMutableArrayRef all_interfaces)
{
CFIndex i;
SCNetworkInterfaceRef interface;
#if !TARGET_OS_IPHONE
// add BT-PAN interface
- addBTPANInterface(prefs, all_interfaces);
+ addBTPANInterface(all_interfaces);
#endif // !TARGET_OS_IPHONE
if (temp_preferences) CFRelease(prefs);
(interfacePrivate->addressString == NULL)) {
uint8_t *bp;
char *cp;
- CFIndex n;
+ size_t n;
char mac[sizeof("xx:xx:xx:xx:xx:xx:xx:xx")];
char *mac_p = mac;
Boolean
_SCNetworkInterfaceIsApplePreconfigured(SCNetworkInterfaceRef interface)
{
-#if !TARGET_OS_SIMULATOR
+#if TARGET_OS_SIMULATOR
+#pragma unused(interface)
+#else // TARGET_OS_SIMULATOR
SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
if (!interfacePrivate->hidden) {
return TRUE;
}
}
-#endif // !TARGET_OS_SIMULATOR
+#endif // TARGET_OS_SIMULATOR
return FALSE;
}
}
-Boolean
-_SCNetworkInterfaceIsModemV92(SCNetworkInterfaceRef interface)
-{
- SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
-
- return interfacePrivate->modemIsV92;
-}
-
-
Boolean
_SCNetworkInterfaceIsTethered(SCNetworkInterfaceRef interface)
{
SCPreferencesRef prefs,
CFStringRef serviceID)
{
+#pragma unused(allocator)
SCNetworkInterfacePrivateRef oldPrivate = (SCNetworkInterfacePrivateRef)interface;
SCNetworkInterfacePrivateRef newPrivate;
if (oldPrivate->overrides != NULL) {
newPrivate->overrides = CFDictionaryCreateMutableCopy(NULL, 0, oldPrivate->overrides);
}
- newPrivate->modemIsV92 = oldPrivate->modemIsV92;
if (oldPrivate->type != NULL) {
newPrivate->type = CFRetain(oldPrivate->type);
}
SCNetworkServicePrimaryRank
SCNetworkInterfaceGetPrimaryRank(SCNetworkInterfaceRef interface)
{
+#pragma unused(interface)
return (kSCNetworkServicePrimaryRankDefault);
}
SCNetworkInterfaceSetPrimaryRank(SCNetworkInterfaceRef interface,
SCNetworkServicePrimaryRank newRank)
{
+#pragma unused(interface)
+#pragma unused(newRank)
_SCErrorSet(kSCStatusInvalidArgument);
return (FALSE);
}
Boolean
SCNetworkInterfaceGetDisableUntilNeeded(SCNetworkInterfaceRef interface)
{
+#pragma unused(interface)
return (FALSE);
}
Boolean
__SCNetworkInterfaceSetDisableUntilNeededValue(SCNetworkInterfaceRef interface, CFTypeRef disable)
{
+#pragma unused(interface)
+#pragma unused(disable)
return (FALSE);
}
Boolean
SCNetworkInterfaceSetDisableUntilNeeded(SCNetworkInterfaceRef interface, Boolean disable)
{
+#pragma unused(interface)
+#pragma unused(disable)
_SCErrorSet(kSCStatusInvalidArgument);
return (FALSE);
}
__private_extern__
CFArrayRef // SCNetworkInterfaceRef
-__SCNetworkInterfaceCopyStoredWithPreferences (SCPreferencesRef ni_prefs)
+__SCNetworkInterfaceCopyStoredWithPreferences(SCPreferencesRef ni_prefs)
{
- CFMutableArrayRef interfaceList = NULL;
+ CFStringRef defaultNetworkInterfacePath = NULL;
CFArrayRef if_list;
- SCNetworkInterfaceRef interfaceNamer = NULL;
- CFStringRef defaultNetworkInterfacePath = NULL;
+ CFMutableArrayRef interfaceList = NULL;
+ SCNetworkInterfaceRef interfaceNamer = NULL;
/* initialize runtime */
pthread_once(&initialized, __SCNetworkInterfaceInitialize);
}
if_list = SCPreferencesGetValue(ni_prefs, INTERFACES);
-
- if (isA_CFArray(if_list) != NULL) {
+ if (isA_CFArray(if_list)) {
CFIndex i;
CFIndex n = CFArrayGetCount(if_list);
dict = CFArrayGetValueAtIndex(if_list, i);
if (isA_CFDictionary(dict) != NULL) {
- interfaceNamer = __SCNetworkInterfaceCreateWithStorageEntity(NULL, dict, ni_prefs);
+ interfaceNamer = __SCNetworkInterfaceCreateWithStorageEntity(NULL, dict);
if (interfaceNamer != NULL) {
CFArrayAppendValue(interfaceList, interfaceNamer);
continue;
}
if (CFEqual(bsdName, tmp_bsdName)) {
- interface = __SCNetworkInterfaceCreateWithStorageEntity(allocator, dict, ni_prefs);
+ interface = __SCNetworkInterfaceCreateWithStorageEntity(allocator, dict);
break;
}
}
} else {
baseURL = CFURLCreateFromFileSystemRepresentation(NULL,
(UInt8*)PREFS_DEFAULT_DIR_PLIST,
- sizeof(PREFS_DEFAULT_DIR_PLIST),
+ sizeof(PREFS_DEFAULT_DIR_PLIST) - 1,
TRUE);
}
CFArrayRef
_SCNetworkConfigurationCopyMigrationPaths(CFDictionaryRef options)
{
+#pragma unused(options)
CFURLRef interfaces;
CFMutableArrayRef migrationPaths = NULL;
CFURLRef prefs;
sizeof(configPathString))) {
SC_log(LOG_NOTICE, "Cannot get file system representation for url: %@", configPathURL);
} else {
- if (remove(configPathString) != 0) {
+ if ((remove(configPathString) != 0) && (errno != ENOENT)) {
SC_log(LOG_INFO, "remove(\"%s\") failed: %s", configPathString, strerror(errno));
}
}
sizeof(configNetworkInterfacesPathString))) {
SC_log(LOG_NOTICE, "Cannot get file system representation for url: %@", configNetworkInterfacesPathURL);
} else {
- if (remove(configNetworkInterfacesPathString) != 0) {
+ if ((remove(configNetworkInterfacesPathString) != 0) && (errno != ENOENT)) {
SC_log(LOG_INFO, "remove(\"%s\") failed: %s", configNetworkInterfacesPathString, strerror(errno));
}
}
}
state = copyfile_state_alloc();
- if ((error = copyfile(preferencesPathString, targetPathString, state, COPYFILE_ALL)) != 0) {
+ error = copyfile(preferencesPathString, targetPathString, state, COPYFILE_ALL);
+ if (error != 0) {
SC_log(LOG_NOTICE, "copyFile(\"%s\", \"%s\", ...) failed: %s",
preferencesPathString,
targetPathString,
(void)chmod(targetPathString, mode);
networkInterfacesState = copyfile_state_alloc();
- if ((error = copyfile(networkInterfacesPathString, targetNetworkInterfacesPathString, networkInterfacesState, COPYFILE_ALL)) != 0) {
+ error = copyfile(networkInterfacesPathString, targetNetworkInterfacesPathString, networkInterfacesState, COPYFILE_ALL);
+ if (error != 0) {
SC_log(LOG_NOTICE, "copyFile(\"%s\", \"%s\", ...) failed: %s",
networkInterfacesPathString,
targetNetworkInterfacesPathString,
SC_log(LOG_NOTICE, "networkInterfaces is NULL");
return NULL;
}
+
if (prefsID == NULL) {
prefsID = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@/%@"), PREFS_DEFAULT_DIR, NETWORK_INTERFACES_PREFS);
- }
- else {
+ } else {
CFRetain(prefsID);
}
-
- ni_prefs = SCPreferencesCreate(NULL, PLUGIN_ID , prefsID);
+ ni_prefs = SCPreferencesCreate(NULL, PLUGIN_ID, prefsID);
CFRelease(prefsID);
-
if (ni_prefs == NULL) {
SC_log(LOG_NOTICE, "ni_prefs is NULL");
goto done;
CFArrayRef
_SCNetworkConfigurationPerformMigration(CFURLRef sourceDir, CFURLRef currentDir, CFURLRef targetDir, CFDictionaryRef options)
{
+#pragma unused(options)
CFURLRef currentDirConfig = NULL;
CFURLRef currentSystemPath = NULL;
Boolean migrationComplete = FALSE;
_sc_debug = 1;
}
+ if ((sourceDir != NULL) && !CFURLHasDirectoryPath(sourceDir)) {
+ SC_log(LOG_INFO, "sourceDir is not a directory: %@", sourceDir);
+ goto done;
+ }
+
+ if ((currentDir != NULL) && !CFURLHasDirectoryPath(currentDir)) {
+ SC_log(LOG_INFO, "currentDir is not a directory: %@", currentDir);
+ goto done;
+ }
+
+ if ((targetDir != NULL) && !CFURLHasDirectoryPath(targetDir)) {
+ SC_log(LOG_INFO, "targetDir is not a directory: %@", targetDir);
+ goto done;
+ }
+
// Both sourceDir and currentDir cannot be NULL because NULL value indicates using current system
if (sourceDir == NULL && currentDir == NULL) {
SC_log(LOG_INFO, "Both sourceDir and currentDir are NULL");
// if either of the sourceDir or currentDir are NULL, then populate it with current system path
if (sourceDir == NULL) {
sourceDirConfig = CFRetain(currentSystemPath);
- }
- else {
+ } else {
sourceDirConfig = CFURLCreateWithFileSystemPathRelativeToBase(NULL, PREFS_DEFAULT_DIR_RELATIVE, kCFURLPOSIXPathStyle, TRUE, sourceDir);
}
// If the targetDir is not provided then migration will take place in currentDir
if (targetDir == NULL) {
targetDirConfig = CFRetain(currentSystemPath);
- }
- else {
+ } else {
targetDirConfig = CFURLCreateWithFileSystemPathRelativeToBase(NULL, PREFS_DEFAULT_DIR_RELATIVE, kCFURLPOSIXPathStyle, TRUE, targetDir);
}
// Source directory cannot be the same as Target Directory
SC_log(LOG_INFO, "Could not copy configuration files from \"%@\" to \"%@\"",
currentDirConfig,
targetDirConfig);
- }
- else if (currentDirConfig != NULL) {
+ } else if (currentDirConfig != NULL) {
removeTargetOnFailure = TRUE; // Configuration files were copied over to target directory
// If migration failed, then we should remove those configuration
// files since current directory and target directory are not
if ((currentDirConfig != NULL) && CFEqual(sourceDirConfig, currentDirConfig)) {
SC_log(LOG_INFO, "No migration needed, source and current configurations point to same path");
migrationComplete = TRUE;
- }
- else {
+ } else {
migrationComplete = _SCNetworkConfigurationMigrateConfiguration(sourceDirConfig, targetDirConfig);
}
if (migrationComplete) {
for (CFIndex idx = 0; idx < count; idx++) {
filePath = CFArrayGetValueAtIndex(*migrationPaths, idx);
- if (_SCNetworkConfigurationMigrateIsFilePresent(filePath) == FALSE) {
+ if (!_SCNetworkConfigurationMigrateIsFilePresent(filePath)) {
SC_log(LOG_INFO, "Required migration file not present: %@", filePath);
goto done;
}
}
type = _SCNetworkInterfaceGetIOInterfaceType(interface);
- if (isA_CFNumber(type) == NULL) {
+ if (!isA_CFNumber(type)) {
SC_log(LOG_INFO, "No interface type");
continue;
}
}
unit = _SCNetworkInterfaceGetIOInterfaceUnit(interface);
-
- if (isA_CFNumber(unit) == NULL) {
+ if (!isA_CFNumber(unit)) {
continue;
}
if (cfMaxTargetUnit != NULL) {
CFNumberGetValue(cfMaxTargetUnit, kCFNumberIntType, &maxTargetUnit);
newTargetUnit = maxTargetUnit + 1;
- }
- else {
+ } else {
newTargetUnit = 0;
}
SC_log(LOG_DEBUG, "sourceInterface: %p, target Interface: %p", sourceInterface, targetInterface);
currentInterfaceUnit = _SCNetworkInterfaceGetIOInterfaceUnit(targetInterface);
-
- if ((isA_CFNumber(currentInterfaceUnit) == NULL) ||
+ if (!isA_CFNumber(currentInterfaceUnit) ||
!CFEqual(currentInterfaceUnit, cfMaxTargetUnit)) {
// Update the interface unit
__SCNetworkInterfaceSetIOInterfaceUnit(targetInterface, cfMaxTargetUnit);
static Boolean
_SCNetworkConfigurationIsInterfaceNamerMappable(SCNetworkInterfaceRef interface1, SCNetworkInterfaceRef interface2, Boolean bypassActive)
{
+#pragma unused(bypassActive)
Boolean interface1IsBuiltin;
CFStringRef interface1Prefix;
CFStringRef interface1Type;
return TRUE;
}
}
- }
- else {
+ } else {
return TRUE;
}
}
CFMutableArrayRef interfacesMissingServices = ctx->interfacesMissingServices;
CFDictionaryRef serviceInterfaceMapping = ctx->interfaceMapping;
- if ((isA_SCNetworkInterface(interface) == NULL) ||
+ if (!isA_SCNetworkInterface(interface) ||
!_SCNetworkInterfaceIsBuiltin(interface)) {
return;
}
}
}
- // Add Service to current set
+ // Add service to current set
currentSet = SCNetworkSetCopyCurrent(prefs);
if (currentSet == NULL) {
SCNetworkServiceRemove(service);
SC_log(LOG_INFO, "Could not add service to current set");
goto done;
}
-done:
+
+ done:
+
if (service != NULL) {
CFRelease(service);
}
if (CFArrayGetCount(memberInterfacesMutable) == 0) {
SC_log(LOG_INFO, "Removing invalid bridge configuration: %@", bridge);
SCBridgeInterfaceRemove(bridge);
- }
- else {
+ } else {
SCBridgeInterfaceSetMemberInterfaces(bridge, memberInterfacesMutable);
}
CFRelease(memberInterfacesMutable);
if (CFArrayGetCount(memberInterfacesMutable) == 0) {
SC_log(LOG_INFO, "Removing invalid bond configuration: %@", bond);
SCBondInterfaceRemove(bond);
- }
- else {
+ } else {
SCBondInterfaceSetMemberInterfaces(bond, memberInterfacesMutable);
}
CFRelease(memberInterfacesMutable);
if (!SCPreferencesCommitChanges(prefs)) {
SC_log(LOG_INFO, "SCPreferencesCommitChanges() failed");
}
- }
- else {
+ } else {
goto done;
}
}
static void
_SCNetworkConfigurationCollectInterfaceStorageEntity(const void *key, const void *value, void *context)
{
+#pragma unused(key)
SCExternalMappingContext* ctx = context;
CFDictionaryRef interface_entity = NULL;
SCNetworkInterfaceRef targetInterface = (SCNetworkInterfaceRef)value;
}
if_list = SCPreferencesGetValue(ni_prefs, INTERFACES);
-
- if ((isA_CFArray(if_list) == NULL) ||
+ if (!isA_CFArray(if_list) ||
((count = CFArrayGetCount(if_list)) == 0)) {
SC_log(LOG_INFO, "No interfaces");
return NULL;
// Keep the same builtin and external interfaces
for (CFIndex idx = 0; idx < count; idx++) {
interface_entity = CFArrayGetValueAtIndex(if_list, idx);
- if (isA_CFDictionary(interface_entity) == NULL) {
+ if (!isA_CFDictionary(interface_entity)) {
continue;
}
CFArrayAppendValue(networkInterfaceList, interface_entity);
}
- if (isA_CFDictionary(externalMapping) == NULL) {
+ if (!isA_CFDictionary(externalMapping)) {
SC_log(LOG_INFO, "No external mapping");
goto done;
}
+
// Add any new external interfaces found
externalInterfaceList = _SCNetworkInterfaceCopyInterfacesFilteredByBuiltinWithPreferences(ni_prefs, FALSE);
context.externalInterfaceList = externalInterfaceList;
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
- if ((internalMapping == NULL) && externalMapping == NULL) {
+ if ((internalMapping == NULL) && (externalMapping == NULL)) {
goto done;
}
targetSet = CFArrayGetValueAtIndex(targetSetsMutable, 0);
CFRetain(targetSet);
CFArrayRemoveValueAtIndex(targetSetsMutable, 0);
- }
- else {
+ } else {
targetSet = SCNetworkSetCreate(targetPrefs);
}
SCNetworkSetSetName(targetSet, setName);
CFRelease(targetSet);
}
-done:
+ done:
+
if (sourceSets != NULL) {
CFRelease(sourceSets);
}
CFArrayRemoveValueAtIndex(targetSCNetworkServicesMutable, idx2);
break;
}
- }
- else {
+ } else {
// Source Interface Type should be VPN
targetInterfaceType = __SCNetworkInterfaceGetEntityType(targetInterface);
if ((isA_CFString(targetInterfaceType) == NULL) ||
CFDictionaryAddValue(serviceMapping, sourceService, kCFBooleanFalse);
}
}
-done:
+
+ done :
+
if (sourceSCNetworkServices != NULL) {
CFRelease(sourceSCNetworkServices);
}
}
computerName = _SCPreferencesCopyComputerName(sourcePrefs, &nameEncoding);
-
if (computerName != NULL) {
SCPreferencesSetComputerName(targetPrefs, computerName, nameEncoding);
CFRelease(computerName);
kSCCompNetwork,
BACK_TO_MY_MAC);
btmm = SCPreferencesPathGetValue(sourcePrefs, btmmPath);
-
if (btmm != NULL) {
SCPreferencesPathSetValue(targetPrefs, btmmPath, btmm);
}
CFDictionaryRef setMapping,
CFDictionaryRef serviceSetMapping)
{
+#pragma unused(sourceNIPrefs)
CFArrayRef allSourceBridges;
CFArrayRef allTargetBridges;
SCBridgeInterfaceRef bridge;
CFDictionaryRef setMapping,
CFDictionaryRef serviceSetMapping)
{
+#pragma unused(sourceNIPrefs)
CFArrayRef allSourceBonds;
CFArrayRef allTargetBonds;
SCBondInterfaceRef bond;
CFDictionaryRef setMapping,
CFDictionaryRef serviceSetMapping)
{
+#pragma unused(sourceNIPrefs)
CFArrayRef allSourceVLAN;
CFArrayRef allTargetVLAN;
SCVirtualInterfaceContext context;
if (*success == FALSE) {
return;
}
+
migratedServiceOrder = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
nonMigratedServices = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
// Creating a list of service IDs which were migrated in the target set
// while maintaining the service order or the source set
CFArrayApplyFunction(sourceServiceOrder, CFRangeMake(0, CFArrayGetCount(sourceServiceOrder)), create_migrated_order, &migrated_context);
-
if (*success == FALSE) {
goto done;
}
SCPreferencesRef targetPrefs,
CFDictionaryRef setMapping)
{
+#pragma unused(sourcePrefs)
+#pragma unused(targetPrefs)
Boolean success = TRUE;
- if (isA_CFDictionary(setMapping) == NULL) {
+ if (!isA_CFDictionary(setMapping)) {
success = FALSE;
goto done;
}
if ((targetPrefs == NULL) || (targetNetworkInterfacePrefs == NULL)) {
goto done;
}
- }
- else {
+ } else {
targetPrefs = __SCNetworkCreateDefaultPref(targetPreferencesFileString);
targetNetworkInterfacePrefs = __SCNetworkCreateDefaultNIPrefs(targetNetworkInterfaceFileString);
}
CFRelease(upgradeSourcePrefs);
CFRelease(upgradeSourceNIPrefs);
- }
- else {
+ } else {
builtinMapping = _SCNetworkConfigurationCopyBuiltinMapping(sourceNetworkInterfacePrefs, targetNetworkInterfacePrefs);
externalMapping = _SCNetworkConfigurationCopyExternalInterfaceMapping(sourceNetworkInterfacePrefs, targetNetworkInterfacePrefs);
CFMutableArrayRef expectedServiceArray = NULL;
CFIndex expectedServiceArrayCount = 0;
CFDictionaryRef expectedServiceDict = NULL;
- CFIndex expectedServiceDictCount = 0;
+ size_t expectedServiceDictCount = 0;
CFDictionaryRef expectedServiceEntity = 0;
Boolean foundMatch = FALSE;
CFMutableArrayRef serviceArray = NULL;
CFIndex serviceArrayCount = 0;
CFDictionaryRef serviceDict = NULL;
- CFIndex serviceDictCount = 0;
+ size_t serviceDictCount = 0;
CFDictionaryRef serviceEntity = NULL;
Boolean success = FALSE;
const void * vals_q[N_QUICK];
const void ** vals = vals_q;
serviceDict = SCPreferencesGetValue(configPref, kSCPrefNetworkServices);
- if (isA_CFDictionary(serviceDict) == NULL) {
+ if (!isA_CFDictionary(serviceDict)) {
goto done;
}
serviceDictCount = CFDictionaryGetCount(serviceDict);
expectedServiceDict = SCPreferencesGetValue(expectedConfigPref, kSCPrefNetworkServices);
- if (isA_CFDictionary(expectedServiceDict) == NULL) {
+ if (!isA_CFDictionary(expectedServiceDict)) {
goto done;
}
expectedServiceDictCount = CFDictionaryGetCount(expectedServiceDict);
CFDictionaryGetKeysAndValues(serviceDict, NULL, vals);
serviceArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
- for (CFIndex idx=0; idx < serviceDictCount; idx++) {
+ for (size_t idx=0; idx < serviceDictCount; idx++) {
serviceEntity = vals[idx];
if (!isA_CFDictionary(serviceEntity)) {
continue;
CFDictionaryGetKeysAndValues(expectedServiceDict, NULL, expected_vals);
expectedServiceArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
- for (CFIndex idx = 0; idx < expectedServiceDictCount; idx++) {
+ for (size_t idx = 0; idx < expectedServiceDictCount; idx++) {
serviceEntity = expected_vals[idx];
if (!isA_CFDictionary(serviceEntity)) {
continue;
Boolean success = FALSE;
interfaceList = SCPreferencesGetValue(configNetworkInterfacePref, INTERFACES);
- if (isA_CFArray(interfaceList) == NULL) {
+ if (!isA_CFArray(interfaceList)) {
goto done;
}
interfaceListMutable = CFArrayCreateMutableCopy(NULL, 0, interfaceList);
interfaceListCount = CFArrayGetCount(interfaceListMutable);
expectedInterfaceList = SCPreferencesGetValue(expectedNetworkInterfacePref, INTERFACES);
- if (isA_CFArray(expectedInterfaceList) == NULL) {
+ if (!isA_CFArray(expectedInterfaceList)) {
goto done;
}
expectedInterfaceListCount = CFArrayGetCount(expectedInterfaceList);
expectedNetworkInterfacePref == NULL) {
SC_log(LOG_INFO, "One of the preferences is NULL");
isIdentical = FALSE;
- }
- else {
+ } else {
isIdentical = (_SCNetworkMigrationAreServicesIdentical(configPref, expectedConfigPref) &&
_SCNetworkMigrationAreNetworkInterfaceConfigurationsIdentical(configNetworkInterfacePref, expectedNetworkInterfacePref));
}
/*
- * Copyright (c) 2004-2008, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2008, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return FALSE; // if not the same protocol type
if (p1->service == p2->service)
- return TRUE; // if both point to the same service
+ return TRUE; // if both point to the same service
if ((p1->service != NULL) && (p2->service != NULL) && CFEqual(p1->service, p2->service))
- return TRUE; // if both effectively point to the same service
+ return TRUE; // if both effectively point to the same service
return FALSE;
}
pthread_once(&initialized, __SCNetworkProtocolInitialize);
/* allocate target */
- size = sizeof(SCNetworkProtocolPrivate) - sizeof(CFRuntimeBase);
+ size = sizeof(SCNetworkProtocolPrivate) - sizeof(CFRuntimeBase);
protocolPrivate = (SCNetworkProtocolPrivateRef)_CFRuntimeCreateInstance(allocator,
- __kSCNetworkProtocolTypeID,
- size,
- NULL);
+ __kSCNetworkProtocolTypeID,
+ size,
+ NULL);
if (protocolPrivate == NULL) {
return NULL;
}
__private_extern__ Boolean
__SCNetworkProtocolIsValidType(CFStringRef protocolType)
{
- int i;
- static const CFStringRef *valid_types[] = {
+ static const CFStringRef *valid_types[] = {
&kSCNetworkProtocolTypeDNS,
&kSCNetworkProtocolTypeIPv4,
&kSCNetworkProtocolTypeIPv6,
#endif // !TARGET_OS_IPHONE
};
- for (i = 0; i < sizeof(valid_types)/sizeof(valid_types[0]); i++) {
+ for (size_t i = 0; i < sizeof(valid_types)/sizeof(valid_types[0]); i++) {
if (CFEqual(protocolType, *valid_types[i])) {
// if known/valid protocol type
return TRUE;
copyProtocolConfigurationPath(SCNetworkProtocolPrivateRef protocolPrivate)
{
CFStringRef path;
- SCNetworkServicePrivateRef servicePrivate;
+ SCNetworkServicePrivateRef servicePrivate;
servicePrivate = (SCNetworkServicePrivateRef)protocolPrivate->service;
path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL, // allocator
servicePrivate->serviceID, // service
- protocolPrivate->entityID); // entity
+ protocolPrivate->entityID); // entity
return path;
}
#pragma mark SCNetworkProtocol APIs
+CFComparisonResult
+_SCNetworkProtocolCompare(const void *val1, const void *val2, void *context)
+{
+#pragma unused(context)
+ SCNetworkProtocolRef p1 = (SCNetworkProtocolRef)val1;
+ SCNetworkProtocolRef p2 = (SCNetworkProtocolRef)val2;
+ CFStringRef type1;
+ CFStringRef type2;
+
+ type1 = SCNetworkProtocolGetProtocolType(p1);
+ type2 = SCNetworkProtocolGetProtocolType(p2);
+
+ return CFStringCompare(type1, type2, 0);
+}
+
+
CFTypeID
SCNetworkProtocolGetTypeID()
{
CFDictionaryRef config;
CFStringRef path;
SCNetworkProtocolPrivateRef protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
- SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)protocolPrivate->service;
+ SCNetworkServicePrivateRef servicePrivate;
if (!isA_SCNetworkProtocol(protocol)) {
_SCErrorSet(kSCStatusInvalidArgument);
return NULL;
}
+ servicePrivate = (SCNetworkServicePrivateRef)protocolPrivate->service;
path = copyProtocolConfigurationPath(protocolPrivate);
config = __getPrefsConfiguration(servicePrivate->prefs, path);
CFRelease(path);
Boolean enabled;
CFStringRef path;
SCNetworkProtocolPrivateRef protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
- SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)protocolPrivate->service;
+ SCNetworkServicePrivateRef servicePrivate;
if (!isA_SCNetworkProtocol(protocol)) {
_SCErrorSet(kSCStatusInvalidArgument);
return FALSE;
}
+ servicePrivate = (SCNetworkServicePrivateRef)protocolPrivate->service;
path = copyProtocolConfigurationPath(protocolPrivate);
enabled = __getPrefsEnabled(servicePrivate->prefs, path);
CFRelease(path);
Boolean ok;
CFStringRef path;
SCNetworkProtocolPrivateRef protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
- SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)protocolPrivate->service;
+ SCNetworkServicePrivateRef servicePrivate;
if (!isA_SCNetworkProtocol(protocol)) {
_SCErrorSet(kSCStatusInvalidArgument);
return FALSE;
}
+ servicePrivate = (SCNetworkServicePrivateRef)protocolPrivate->service;
path = copyProtocolConfigurationPath(protocolPrivate);
ok = __setPrefsConfiguration(servicePrivate->prefs, path, config, TRUE);
CFRelease(path);
Boolean ok;
CFStringRef path;
SCNetworkProtocolPrivateRef protocolPrivate = (SCNetworkProtocolPrivateRef)protocol;
- SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)protocolPrivate->service;
+ SCNetworkServicePrivateRef servicePrivate;
if (!isA_SCNetworkProtocol(protocol)) {
_SCErrorSet(kSCStatusInvalidArgument);
return FALSE;
}
+ servicePrivate = (SCNetworkServicePrivateRef)protocolPrivate->service;
path = copyProtocolConfigurationPath(protocolPrivate);
ok = __setPrefsEnabled(servicePrivate->prefs, path, enabled);
CFRelease(path);
/*
- * Copyright (c) 2003-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFRuntime.h>
-#define SC_LOG_HANDLE __log_SCNetworkReachability()
+#define SC_LOG_HANDLE __log_SCNetworkReachability()
+#define SC_LOG_HANDLE_TYPE static
#include <SystemConfiguration/SystemConfiguration.h>
#include <SystemConfiguration/SCValidation.h>
#include <SystemConfiguration/SCPrivate.h>
CFStringAppendFormat(result, NULL, CFSTR(" (%s"), (targetPrivate->lastResolverStatus == nw_resolver_status_complete) ? "complete" : "in progress");
if (nw_array_get_count(targetPrivate->lastResolvedEndpoints) > 0) {
nw_array_apply(targetPrivate->lastResolvedEndpoints, ^bool(size_t index, nw_object_t object) {
+#pragma unused(index)
nw_endpoint_t endpoint = (nw_endpoint_t)object;
nw_endpoint_type_t endpoint_type = nw_endpoint_get_type(endpoint);
if (endpoint_type == nw_endpoint_type_address) {
}
+#if !TARGET_OS_IPHONE
static Boolean
is_ipv4_loopback(const struct sockaddr *sa)
{
addr = ntohl(sin->sin_addr.s_addr);
return IN_LOOPBACK(addr) ? TRUE : FALSE;
}
+#endif // !TARGET_OS_IPHONE
static Boolean
}
data = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionLocalAddress);
if (data != NULL) {
- if (!isA_CFData(data) || (CFDataGetLength(data) < sizeof(struct sockaddr_in))) {
+ if (!isA_CFData(data) || ((size_t)CFDataGetLength(data) < sizeof(struct sockaddr_in))) {
_SCErrorSet(kSCStatusInvalidArgument);
return NULL;
}
}
data = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionPTRAddress);
if (data != NULL) {
- if (!isA_CFData(data) || (CFDataGetLength(data) < sizeof(struct sockaddr_in))) {
+ if (!isA_CFData(data) || ((size_t)CFDataGetLength(data) < sizeof(struct sockaddr_in))) {
_SCErrorSet(kSCStatusInvalidArgument);
return NULL;
}
}
data = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionRemoteAddress);
if (data != NULL) {
- if (!isA_CFData(data) || (CFDataGetLength(data) < sizeof(struct sockaddr_in))) {
+ if (!isA_CFData(data) || ((size_t)CFDataGetLength(data) < sizeof(struct sockaddr_in))) {
_SCErrorSet(kSCStatusInvalidArgument);
return NULL;
}
if (nw_array_get_count(targetPrivate->lastResolvedEndpoints) > 0) {
array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
nw_array_apply(targetPrivate->lastResolvedEndpoints, ^bool(size_t index, nw_object_t object) {
+#pragma unused(index)
nw_endpoint_type_t endpoint_type = nw_endpoint_get_type((nw_endpoint_t)object);
if (endpoint_type == nw_endpoint_type_address) {
const struct sockaddr *address = nw_endpoint_get_address((nw_endpoint_t)object);
xpc_object_t agent_dictionary = nw_path_copy_netagent_dictionary(path);
if (agent_dictionary != NULL) {
if (xpc_dictionary_get_count(agent_dictionary) > 0) {
- xpc_dictionary_apply(agent_dictionary, ^bool(__unused const char *key, xpc_object_t value) {
+ xpc_dictionary_apply(agent_dictionary, ^bool(const char *key, xpc_object_t value) {
+#pragma unused(key)
Boolean vpn = FALSE;
Boolean onDemand = FALSE;
__SCNetworkReachabilityGetAgentVPNFlags(value, &vpn, &onDemand);
targetPrivate->lastResolvedEndpointFlags = 0;
targetPrivate->lastResolvedEndpointInterfaceIndex = 0;
nw_array_apply(targetPrivate->lastResolvedEndpoints, ^bool(size_t index, nw_object_t object) {
+#pragma unused(index)
SCNetworkReachabilityFlags flags = 0;
uint interfaceIndex = 0;
ReachabilityRankType rank;
Boolean *haveDNS,
struct sockaddr *sa)
{
+#pragma unused(storeP)
+#pragma unused(sa)
nw_path_evaluator_t evaluator = nw_path_create_default_evaluator();
nw_path_t path = nw_path_evaluator_copy_path(evaluator);
if (nw_path_get_status(path) == nw_path_status_unsatisfied_network) {
/*
- * Copyright (c) 2003-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
_SCNetworkReachabilityCopyTargetDescription (SCNetworkReachabilityRef target);
-static __inline__ CFStringRef
-__SCNetworkReachabilityCopyFlags(SCNetworkReachabilityFlags flags, CFStringRef prefix, Boolean debug)
-{
- CFMutableStringRef str = CFStringCreateMutable(NULL, 0);
-
- if (prefix != NULL) {
- CFStringAppend(str, prefix);
- }
-
- if (debug) {
- CFStringAppendFormat(str, NULL, CFSTR("0x%08x ("), flags);
- }
-
- if (flags == 0) {
- CFStringAppend(str, CFSTR("Not Reachable"));
- }
- if (flags & kSCNetworkReachabilityFlagsReachable) {
- flags &= ~kSCNetworkReachabilityFlagsReachable;
- CFStringAppendFormat(str, NULL, CFSTR("Reachable%s"),
- flags != 0 ? ", " : "");
- }
- if (flags & kSCNetworkReachabilityFlagsTransientConnection) {
- flags &= ~kSCNetworkReachabilityFlagsTransientConnection;
- CFStringAppendFormat(str, NULL, CFSTR("Transient Connection%s"),
- flags != 0 ? ", " : "");
- }
- if (flags & kSCNetworkReachabilityFlagsConnectionRequired) {
- flags &= ~kSCNetworkReachabilityFlagsConnectionRequired;
- CFStringAppendFormat(str, NULL, CFSTR("Connection Required%s"),
- flags != 0 ? ", " : "");
- }
- if (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) {
- flags &= ~kSCNetworkReachabilityFlagsConnectionOnTraffic;
- CFStringAppendFormat(str, NULL, CFSTR("Automatic Connection On Traffic%s"),
- flags != 0 ? ", " : "");
- }
- if (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) {
- flags &= ~kSCNetworkReachabilityFlagsConnectionOnDemand;
- CFStringAppendFormat(str, NULL, CFSTR("Automatic Connection On Demand%s"),
- flags != 0 ? ", " : "");
- }
- if (flags & kSCNetworkReachabilityFlagsInterventionRequired) {
- flags &= ~kSCNetworkReachabilityFlagsInterventionRequired;
- CFStringAppendFormat(str, NULL, CFSTR("Intervention Required%s"),
- flags != 0 ? ", " : "");
- }
- if (flags & kSCNetworkReachabilityFlagsIsLocalAddress) {
- flags &= ~kSCNetworkReachabilityFlagsIsLocalAddress;
- CFStringAppendFormat(str, NULL, CFSTR("Local Address%s"),
- flags != 0 ? ", " : "");
- }
- if (flags & kSCNetworkReachabilityFlagsIsDirect) {
- flags &= ~kSCNetworkReachabilityFlagsIsDirect;
- CFStringAppendFormat(str, NULL, CFSTR("Directly Reachable Address%s"),
- flags != 0 ? ", " : "");
- }
-#if TARGET_OS_IPHONE
- if (flags & kSCNetworkReachabilityFlagsIsWWAN) {
- flags &= ~kSCNetworkReachabilityFlagsIsWWAN;
- CFStringAppendFormat(str, NULL, CFSTR("WWAN%s"), flags != 0 ? ", " : "");
- }
-#endif // TARGET_OS_IPHONE
- if (flags != 0) {
- CFStringAppendFormat(str, NULL, CFSTR("0x%08x"), flags);
- }
-
- if (debug) {
- CFStringAppend(str, CFSTR(")"));
- }
-
- return str;
-}
-
static __inline__ ReachabilityRankType
__SCNetworkReachabilityRank(SCNetworkReachabilityFlags flags)
{
--- /dev/null
+/*
+ * Copyright (c) 2017 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 _SCNETWORKREACHABILITYLOGGING_H
+#define _SCNETWORKREACHABILITYLOGGING_H
+
+#include <Availability.h>
+#include <TargetConditionals.h>
+#include <assert.h>
+#include <sys/cdefs.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
+__BEGIN_DECLS
+
+/*
+ * __SCNetworkReachability_flags_string()
+ *
+ * Returns a string representation of the SCNetworkReachability flags.
+ * debug==FALSE : " Reachable,Transient Connection,WWAN,..."
+ * debug==TRUE : " 0x01234567 (Reachable,Transient Connection,WWAN,...)"
+ */
+static __inline__ void
+__SCNetworkReachability_flags_string(SCNetworkReachabilityFlags flags, Boolean debug, char *str, size_t len)
+{
+ size_t n;
+ size_t op; // open paren
+ SCNetworkReachabilityFlags remaining;
+
+ assert((len >= sizeof("Not Reachable," )) && // check min buffer size
+ (len >= sizeof("0x01234567 (Not Reachable)")) &&
+ (len >= sizeof("0x01234567 (0x01234567)" )));
+
+ if (!debug) {
+ n = 0;
+ str[n] = '\0';
+ } else {
+ n = snprintf(str, len, "0x%08x (", flags);
+ len--; // leave room for the closing paren
+ }
+ op = n;
+ remaining = flags;
+
+ if ((remaining == 0) &&
+ (n < len) && ((len - n) > sizeof("Not Reachable,"))) {
+ n = strlcat(str, "Not Reachable,", len);
+ }
+
+ if ((remaining & kSCNetworkReachabilityFlagsReachable) &&
+ (n < len) && ((len - n) > sizeof("Reachable,"))) {
+ n = strlcat(str, "Reachable,", len);
+ remaining &= ~kSCNetworkReachabilityFlagsReachable;
+ }
+
+ if ((remaining & kSCNetworkReachabilityFlagsTransientConnection) &&
+ (n < len) && ((len - n) > sizeof("Transient Connection,"))) {
+ n = strlcat(str, "Transient Connection,", len);
+ remaining &= ~kSCNetworkReachabilityFlagsTransientConnection;
+ }
+
+ if ((remaining & kSCNetworkReachabilityFlagsConnectionRequired) &&
+ (n < len) && ((len - n) > sizeof("Connection Required,"))) {
+ n = strlcat(str, "Connection Required,", len);
+ remaining &= ~kSCNetworkReachabilityFlagsConnectionRequired;
+ }
+
+ if ((remaining & kSCNetworkReachabilityFlagsConnectionOnTraffic) &&
+ (n < len) && ((len - n) > sizeof("Automatic Connection On Traffic,"))) {
+ n = strlcat(str, "Automatic Connection On Traffic,", len);
+ remaining &= ~kSCNetworkReachabilityFlagsConnectionOnTraffic;
+ }
+
+ if ((remaining & kSCNetworkReachabilityFlagsConnectionOnDemand) &&
+ (n < len) && ((len - n) > sizeof("Automatic Connection On Demand,"))) {
+ n = strlcat(str, "Automatic Connection On Demand,", len);
+ remaining &= ~kSCNetworkReachabilityFlagsConnectionOnDemand;
+ }
+
+ if ((remaining & kSCNetworkReachabilityFlagsInterventionRequired) &&
+ (n < len) && ((len - n) > sizeof("Intervention Required,"))) {
+ n = strlcat(str, "Intervention Required,", len);
+ remaining &= ~kSCNetworkReachabilityFlagsInterventionRequired;
+ }
+
+ if ((remaining & kSCNetworkReachabilityFlagsIsLocalAddress) &&
+ (n < len) && ((len - n) > sizeof("Local Address,"))) {
+ n = strlcat(str, "Local Address,", len);
+ remaining &= ~kSCNetworkReachabilityFlagsIsLocalAddress;
+ }
+
+ if ((remaining & kSCNetworkReachabilityFlagsIsDirect) &&
+ (n < len) && ((len - n) > sizeof("Directly Reachable Address,"))) {
+ n = strlcat(str, "Directly Reachable Address,", len);
+ remaining &= ~kSCNetworkReachabilityFlagsIsDirect;
+ }
+
+#if TARGET_OS_IPHONE
+ if ((remaining & kSCNetworkReachabilityFlagsIsWWAN) &&
+ (n < len) && ((len - n) > sizeof("WWAN,"))) {
+ n = strlcat(str, "WWAN,", len);
+ remaining &= ~kSCNetworkReachabilityFlagsIsWWAN;
+ }
+#endif // TARGET_OS_IPHONE
+
+ if (remaining != 0) {
+ if ((n >= len) ||
+ ((len - n) <= sizeof("0x01234567,"))) {
+ // if we don't have enough space, truncate and start over
+ str[op] = '\0';
+ n = op;
+ remaining = flags;
+ }
+
+ n += snprintf(str + n, len - n, "0x%08x,", remaining);
+ }
+
+ if (n-- > 0) {
+ if (!debug) {
+ str[n] = '\0'; // remove trailing ","
+ } else {
+ str[n] = ')'; // trailing "," --> ")"
+ }
+ }
+
+ return;
+}
+
+__END_DECLS
+
+#endif /* _SCNETWORKREACHABILITYLOGGING_H */
/*
- * Copyright (c) 2004-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
CFStringRef entities[] = { kSCPropNetInterfaceType,
kSCPropNetInterfaceSubType,
kSCPropNetInterfaceHardware };
- int i;
// include the "Interface" entity itself
CFSetAddValue(interface_entity_types, kSCEntNetInterface);
// include the entities associated with the interface
- for (i = 0; i < sizeof(entities)/sizeof(entities[0]); i++) {
+ for (size_t i = 0; i < sizeof(entities)/sizeof(entities[0]); i++) {
CFStringRef entity;
entity = CFDictionaryGetValue(interface, entities[i]);
CFRelease(path);
useSystemInterfaces = ((__SCPreferencesUsingDefaultPrefs(servicePrivate->prefs)) &&
- (__SCPreferencesGetLimitSCNetworkConfiguration(servicePrivate->prefs) == FALSE));
+ !__SCPreferencesGetLimitSCNetworkConfiguration(servicePrivate->prefs));
if (isA_CFDictionary(entity)) {
name = CFDictionaryGetValue(entity, kSCPropUserDefinedName);
sets = SCNetworkSetCopyAll(servicePrivate->prefs);
if (sets != NULL) {
- CFIndex i;
CFIndex n;
n = CFArrayGetCount(sets);
- for (i = 0; i < n; i++) {
+ for (CFIndex i = 0; i < n; i++) {
SCNetworkSetRef set;
set = CFArrayGetValueAtIndex(sets, i);
}
// remove link between "set" and old "service"
- SCPreferencesPathRemoveValue(setPrivate->prefs, path);
+ (void) SCPreferencesPathRemoveValue(setPrivate->prefs, path);
CFRelease(path);
// create the link between "set" and the "service"
link = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL, // allocator
service_context->newServiceID, // service
NULL); // entity
- SCPreferencesPathSetLink(setPrivate->prefs, path, link);
+ (void) SCPreferencesPathSetLink(setPrivate->prefs, path, link);
done:
ok = SCPreferencesPathSetLink(setPrivate->prefs, path, link);
#ifdef PREVENT_DUPLICATE_SERVICE_NAMES
if (ok) {
+ // We use the interface cache here to not reach into the
+ // IORegistry for every service we go through
+ _SCNetworkInterfaceCacheOpen();
ok = ensure_unique_service_name(service);
+ _SCNetworkInterfaceCacheClose();
+
if (!ok) {
// if we could not ensure a unique name, remove the (just added)
// link between the "set" and the "service"
}
+CFComparisonResult
+_SCNetworkSetCompare(const void *val1, const void *val2, void *context)
+{
+#pragma unused(context)
+ CFStringRef id1;
+ CFStringRef id2;
+ CFStringRef name1;
+ CFStringRef name2;
+ SCNetworkSetRef s1 = (SCNetworkSetRef)val1;
+ SCNetworkSetRef s2 = (SCNetworkSetRef)val2;
+
+ name1 = SCNetworkSetGetName(s1);
+ name2 = SCNetworkSetGetName(s2);
+
+ if (name1 != NULL) {
+ if (name2 != NULL) {
+ return CFStringCompare(name1, name2, 0);
+ } else {
+ return kCFCompareLessThan;
+ }
+ }
+
+ if (name2 != NULL) {
+ return kCFCompareGreaterThan;
+ }
+
+ id1 = SCNetworkSetGetSetID(s1);
+ id2 = SCNetworkSetGetSetID(s2);
+ return CFStringCompare(id1, id2, 0);
+}
+
+
static Boolean
__SCNetworkSetEstablishDefaultConfigurationForInterfaces(SCNetworkSetRef set, CFArrayRef interfaces, Boolean excludeHidden)
{
/*
- * Copyright (c) 2006, 2008, 2009, 2011-2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2006, 2008, 2009, 2011-2015, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
}
static CFDictionaryRef
-copy_services_for_address_family(CFAllocatorRef alloc,
- int af)
+copy_services_for_address_family(CFAllocatorRef alloc, int af)
{
+#pragma unused(alloc)
CFDictionaryRef info;
CFArrayRef patterns;
CFStringRef pattern;
SCNetworkSignatureCopyActiveIdentifierForAddress(CFAllocatorRef alloc,
const struct sockaddr * addr)
{
+#pragma unused(alloc)
CFStringRef ident = NULL;
CFDictionaryRef info = NULL;
CFStringRef global_state_v4_key = NULL;
CFArrayRef /* of CFStringRef's */
SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc)
{
+#pragma unused(alloc)
CFMutableArrayRef active = NULL;
CFIndex count = 0;
CFStringRef global_setup_v4_key = NULL;
/*
- * Copyright (c) 2006, 2008, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2006, 2008, 2011, 2012, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
@function SCNetworkSignatureCopyActiveIdentifiers
@discussion Find all currently active networks and return a list of
(string) identifiers, one for each network.
- @param allocator The CFAllocator that should be used to allocate
+ @param alloc 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
@discussion Find the one active network associated with the specified
address and return the unique (string) identifier that
represents it.
- @param allocator The CFAllocator that should be used to allocate
+ @param alloc 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
@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
+ @param alloc 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
/*
- * Copyright (c) 2000, 2001, 2003-2005, 2007-2009, 2011, 2014-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007-2009, 2011, 2014-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
newPath = CFStringCreateMutable(NULL, 0);
CFStringAppendFormat(newPath, NULL, CFSTR("%s"), prefsPath);
- CFStringFindAndReplace(newPath, PREFS_DEFAULT_CONFIG,
+ CFStringFindAndReplace(newPath,
+ PREFS_DEFAULT_CONFIG,
NETWORK_INTERFACES_PREFS,
CFRangeMake(0, CFStringGetLength(newPath)),
kCFCompareBackwards);
newURL = CFURLCreateWithFileSystemPath(NULL, newPath, kCFURLPOSIXPathStyle, FALSE);
if (!CFURLResourceIsReachable(newURL, NULL)) {
ni_prefs = __SCNetworkCreateDefaultNIPrefs(newPath);
- }
- else {
+ } else {
ni_prefs = SCPreferencesCreate(NULL, prefsPrivate->name, newPath);
}
CFAllocatorDeallocate(NULL, prefsPath);
/*
- * Copyright (c) 2000-2008, 2010-2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008, 2010-2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
int fd;
CFDataRef newPrefs;
CFIndex pathLen;
+#if TARGET_OS_EMBEDDED
+ CFStringRef protectionClass;
+#endif // TARGET_OS_EMBEDDED
char * thePath;
if (stat(prefsPrivate->path, &statBuf) == -1) {
thePath = CFAllocatorAllocate(NULL, pathLen, 0);
snprintf(thePath, pathLen, "%s-new", path);
+#if TARGET_OS_EMBEDDED
+ if ((prefsPrivate->options != NULL) &&
+ CFDictionaryGetValueIfPresent(prefsPrivate->options,
+ kSCPreferencesOptionProtectionClass,
+ (const void **)&protectionClass)) {
+ int pc;
+ const char *str;
+
+ if (!isA_CFString(protectionClass) ||
+ (CFStringGetLength(protectionClass) != 1) ||
+ ((str = CFStringGetCStringPtr(protectionClass, kCFStringEncodingASCII)) == NULL) ||
+ (str[0] < 'A') || (str[0] > 'F')
+ ) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ goto done;
+ }
+
+ pc = str[0] - 'A' + 1; // PROTECTION_CLASS_[ABCDEF]
+ fd = open_dprotected_np(thePath, O_WRONLY|O_CREAT, pc, 0, statBuf.st_mode);
+ } else
+#endif // TARGET_OS_EMBEDDED
fd = open(thePath, O_WRONLY|O_CREAT, statBuf.st_mode);
+
if (fd == -1) {
_SCErrorSet(errno);
SC_log(LOG_INFO, "open() failed: %s", strerror(errno));
/*
- * Copyright (c) 2000-2010, 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2010, 2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static gid_t group = -1;
// set group
- if (group == -1) {
+ if (group == (gid_t)-1) {
char buf[256];
struct group grp;
struct group *grpP = NULL;
/*
- * Copyright(c) 2000-2016 Apple Inc. All rights reserved.
+ * Copyright(c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
{
SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)cf;
+ SC_log(LOG_DEBUG, "release %@", prefsPrivate);
+
/* release resources */
pthread_mutex_destroy(&prefsPrivate->lock);
SCPreferencesPrivateRef prefsPrivate;
prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, NULL, NULL);
+ if (prefsPrivate != NULL) {
+ SC_log(LOG_DEBUG, "create %@", prefsPrivate);
+ }
+
return (SCPreferencesRef)prefsPrivate;
}
}
prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, authorizationData, options);
+ if (prefsPrivate != NULL) {
+ const char *astr = "";
+ const char *ostr = "";
+
+ if (options != NULL) {
+ ostr = "options";
+ }
+
+ if (authorization != NULL) {
+ if (authorization == kSCPreferencesUseEntitlementAuthorization) {
+ astr = "entitlement";
+ } else {
+ astr = "authorization";
+ }
+ }
+
+ SC_log(LOG_DEBUG, "create w/%s%s%s %@",
+ ostr,
+ ((ostr != "") && (astr != "")) ? " + " : "",
+ astr,
+ prefsPrivate);
+ }
+
if (authorizationData != NULL) CFRelease(authorizationData);
return (SCPreferencesRef)prefsPrivate;
static void
prefsNotify(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
{
+#pragma unused(store)
void *context_info;
void (*context_release)(const void *);
CFIndex i;
if (rlsFunction != NULL) {
SC_log(LOG_DEBUG, "exec SCPreferences callout: %s%s%s",
((notify & kSCPreferencesNotificationCommit) != 0) ? "commit" : "",
- ((notify & kSCPreferencesNotificationCommit|kSCPreferencesNotificationApply) != 0) ? ", " : "",
+ (((notify & kSCPreferencesNotificationCommit) != 0) &&
+ ((notify & kSCPreferencesNotificationApply ) != 0)) ? ", " : "",
((notify & kSCPreferencesNotificationApply) != 0) ? "apply" : "");
(*rlsFunction)(prefs, notify, context_info);
}
SC_log(LOG_INFO, "SCDynamicStoreCreate() failed");
return FALSE;
}
+
+ SC_log(LOG_DEBUG, "added SCDynamicStore session (for prefs)");
}
prefsPrivate->sessionRefcnt++;
if (--prefsPrivate->sessionRefcnt == 0) {
CFRelease(prefsPrivate->session);
prefsPrivate->session = NULL;
+
+ SC_log(LOG_DEBUG, "removed SCDynamicStore session (for prefs)");
}
}
prefsPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
}
+ SC_log(LOG_DEBUG, "scheduled");
+
prefsPrivate->scheduled = TRUE;
}
if (n == 0) {
CFArrayRef changedKeys;
+ SC_log(LOG_DEBUG, "unscheduled");
+
// if *all* notifications have been unscheduled
prefsPrivate->scheduled = FALSE;
/*
- * Copyright (c) 2006, 2007, 2010, 2014, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2006, 2007, 2010, 2014, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return keychain_password;
#else // !TARGET_OS_IPHONE
+#pragma unused(keychain)
+#pragma unused(unique_id)
_SCErrorSet(kSCStatusAccessError);
return NULL;
#endif // !TARGET_OS_IPHONE
CFRelease(item);
return TRUE;
#else // !TARGET_OS_IPHONE
+#pragma unused(keychain)
+#pragma unused(unique_id)
_SCErrorSet(kSCStatusAccessError);
return FALSE;
#endif // !TARGET_OS_IPHONE
return TRUE;
#else // !TARGET_OS_IPHONE
+#pragma unused(keychain)
+#pragma unused(unique_id)
_SCErrorSet(kSCStatusAccessError);
return FALSE;
#endif // !TARGET_OS_IPHONE
return TRUE;
#else // !TARGET_OS_IPHONE
+#pragma unused(keychain)
+#pragma unused(unique_id)
+#pragma unused(label)
+#pragma unused(description)
+#pragma unused(account)
+#pragma unused(password)
+#pragma unused(options)
_SCErrorSet(kSCStatusAccessError);
return FALSE;
#endif // !TARGET_OS_IPHONE
if (keychain != NULL) CFRelease(keychain);
return password;
#else // !TARGET_OS_IPHONE
+#pragma unused(prefs)
+#pragma unused(unique_id)
_SCErrorSet(kSCStatusAccessError);
return NULL;
#endif // !TARGET_OS_IPHONE
if (keychain != NULL) CFRelease(keychain);
return ok;
#else // !TARGET_OS_IPHONE
+#pragma unused(prefs)
+#pragma unused(unique_id)
_SCErrorSet(kSCStatusAccessError);
return FALSE;
#endif // !TARGET_OS_IPHONE
if (keychain != NULL) CFRelease(keychain);
return ok;
#else // !TARGET_OS_IPHONE
+#pragma unused(prefs)
+#pragma unused(unique_id)
_SCErrorSet(kSCStatusAccessError);
return FALSE;
#endif // !TARGET_OS_IPHONE
if (keychain != NULL) CFRelease(keychain);
return ok;
#else // !TARGET_OS_IPHONE
+#pragma unused(prefs)
+#pragma unused(unique_id)
+#pragma unused(label)
+#pragma unused(description)
+#pragma unused(account)
+#pragma unused(password)
+#pragma unused(options)
_SCErrorSet(kSCStatusAccessError);
return FALSE;
#endif // !TARGET_OS_IPHONE
/*
- * Copyright (c) 2000-2005, 2007-2009, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2007-2009, 2011, 2012, 2017 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,
* 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 <Availability.h>
+#include <TargetConditionals.h>
#include <sys/cdefs.h>
#include <CoreFoundation/CoreFoundation.h>
#include <SystemConfiguration/SCPreferences.h>
*/
#define kSCPreferencesOptionChangeNetworkSet CFSTR("change-network-set") // CFBooleanRef
+#if TARGET_OS_EMBEDDED
+/*!
+ @defined kSCPreferencesOptionProtectionClass
+ @abstract The SCPreferences "option" used to indicate the file
+ protection class of the .plist.
+ */
+#define kSCPreferencesOptionProtectionClass CFSTR("ProtectionClass") // CFStringRef["A"-"F"]
+#endif // TARGET_OS_EMBEDDED
+
/*!
@defined kSCPreferencesOptionRemoveWhenEmpty
@abstract The SCPreferences "option" used to indicate that the .plist
/*
- * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <sys/cdefs.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#include <asl.h>
#include <sys/syslog.h>
#include <mach/message.h>
#include <os/activity.h>
#endif
+/* crash report(s) directory path */
+#if !TARGET_OS_EMBEDDED
+#define _SC_CRASH_DIR "/Library/Logs/DiagnosticReports"
+#else
+#define _SC_CRASH_DIR "/Library/Logs/CrashReporter"
+#endif
+
+
/* framework variables */
extern int _sc_debug; /* non-zero if debugging enabled */
extern int _sc_verbose; /* non-zero if verbose logging enabled */
extern int _sc_log; /* 0 if SC messages should be written to stdout/stderr,
- 1 if SC messages should be logged w/asl(3),
+ 1 if SC messages should be logged w/os_log(3),
2 if SC messages should be written to stdout/stderr AND logged */
/*!
@function _SC_LOG_DEFAULT
- @discussion Maps a syslog/asl logging level to an os_log level.
- @param level The syslog/asl logging level
- @result The os_log level
+ @discussion A function returning a default os_log_t object to be
+ used for [SystemConfiguration] logging.
+ @result The os_log_t object
*/
os_log_t _SC_LOG_DEFAULT ();
/*!
@function _SC_syslog_os_log_mapping
- @discussion Maps a syslog/asl logging level to an os_log level.
- @param level The syslog/asl logging level
+ @discussion Maps a syslog logging level to an os_log level.
+ @param level The syslog logging level
@result The os_log level
*/
os_log_type_t _SC_syslog_os_log_mapping (int level);
@param condition A boolean value indicating if the message should be logged
@param level A syslog(3) logging priority.
@param formatString The format string
- @result The specified message will be written to the system message
- logger (See syslogd(8)).
*/
void SCLog (Boolean condition,
int level,
...) CF_FORMAT_FUNCTION(3, 4);
-typedef CF_ENUM(uint32_t, SCLoggerFlags) {
- kSCLoggerFlagsNone = 0x0,
- kSCLoggerFlagsDefault = 0x1,
- kSCLoggerFlagsFile = 0x2
-};
-
-typedef struct SCLogger * SCLoggerRef;
-
-
-/*!
- @function SCLoggerLog
- @discussion Logs messages using SCLoggerRef
- @param logger A SCLoggerRef which keeps information about how logging
- needs to be done. Passing NULL uses the default logger instance.
- @param level An asl(3) logging priority. Passing the complement of a logging
- priority (e.g. ~ASL_LEVEL_NOTICE) will result in log message lines
- NOT being split by a "\n".
- @param formatString The format string followed by format arguments
- @result The specified message will be written to the system message
- logger (See syslogd(8)). If logger is in verbose mode, the message
- will be also written to a file specified in the ASL Module
- */
-void SCLoggerLog (SCLoggerRef logger,
- int level,
- CFStringRef formatString,
- ...) CF_FORMAT_FUNCTION(3, 4)
- __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_6_0);
-
-/*!
- @function SCLoggerVLog
- @discussion Logs messages using SCLoggerRef
- @param logger A SCLoggerRef which keeps information about how logging
- needs to be done. Passing NULL uses the default logger instance.
- @param level An asl(3) logging priority. Passing the complement of a logging
- priority (e.g. ~ASL_LEVEL_NOTICE) will result in log message lines
- NOT being split by a "\n".
- @param formatString The format string
- @param args The va_list representing the arguments
- @result The specified message will be written to the system message
- logger (See syslogd(8)). If logger is in verbose mode, the message
- will be also written to a file specified in the ASL Module
- */
-void SCLoggerVLog (SCLoggerRef logger,
- int level,
- CFStringRef formatString,
- va_list args) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
-
-
-/*!
- @function SCLOG
- @discussion Issue a log message.
- @param asl An asl client handle to be used for logging. If NULL, a shared
- handle will be used.
- @param msg An asl msg structure to be used for logging. If NULL, a default
- asl msg will be used.
- @param level A asl(3) logging priority. Passing the complement of a logging
- priority (e.g. ~ASL_LEVEL_NOTICE) will result in log message lines
- NOT being split by a "\n".
- @param formatString The format string
- @result The specified message will be written to the system message
- logger (See syslogd(8)).
- */
-void SCLOG (asl_object_t asl,
- asl_object_t msg,
- int level,
- CFStringRef formatString,
- ...) CF_FORMAT_FUNCTION(4, 5);
-
-
/*!
@function SC_log
@discussion Issue an os_log() message.
@result The specified message will be written to the unified logging system.
*/
#ifndef SC_log
-
-#ifndef SC_LOG_HANDLE
-#define SC_LOG_HANDLE _SC_LOG_DEFAULT() // use [SC] default os_log handle
-
-#ifndef SC_LOG_OR_PRINT
-#define USE_SC_LOG_OR_PRINT // use '_sc_log' to control os_log, printf
-#endif // !SC_LOG_OR_PRINT
-
-#endif // !SC_LOG_HANDLE
-
-#ifdef USE_SC_LOG_OR_PRINT
-
-#define SC_log(__level, __format, ...) \
+ #ifdef SC_LOG_HANDLE
+ #ifndef SC_LOG_HANDLE_TYPE
+ #define SC_LOG_HANDLE_TYPE
+ #endif // SC_LOG_HANDLE_TYPE
+ SC_LOG_HANDLE_TYPE os_log_t SC_LOG_HANDLE;
+ #else // SC_LOG_HANDLE
+ #define SC_LOG_HANDLE _SC_LOG_DEFAULT() // use [SC] default os_log handle
+ #ifndef SC_LOG_OR_PRINT
+ #define USE_SC_LOG_OR_PRINT 1 // and use '_sc_log' to control os_log, printf
+ #endif // !SC_LOG_OR_PRINT
+ #endif // !SC_LOG_HANDLE
+
+ #if USE_SC_LOG_OR_PRINT
+ #define SC_log(__level, __format, ...) \
do { \
os_log_t __handle = SC_LOG_HANDLE; \
os_log_type_t __type = _SC_syslog_os_log_mapping(__level); \
\
- if ((_sc_log != 1) || os_log_type_enabled(__handle, __type)) { \
+ if (((_sc_log != 1) && ((__level > LOG_DEBUG) || _sc_debug)) || \
+ os_log_type_enabled(__handle, __type)) { \
__SC_Log(__level, \
CFSTR( __format ), \
__handle, \
## __VA_ARGS__); \
} \
} while (0)
-
-#else // USE_SC_LOG_OR_PRINT
-
-#define SC_log(__level, __format, ...) \
+ #else // USE_SC_LOG_OR_PRINT
+ #define SC_log(__level, __format, ...) \
do { \
os_log_type_t __type = _SC_syslog_os_log_mapping(__level); \
os_log_with_type(SC_LOG_HANDLE, __type, __format, ## __VA_ARGS__); \
} while (0)
-
-#endif // USE_SC_LOG_OR_PRINT
-
+ #endif // USE_SC_LOG_OR_PRINT
#endif // !SC_log
/*!
@function __SC_Log
@discussion Issue a log message w/os_log(3) or printf(3).
+ The specified message will be written to the system message
+ logger.
@param level A syslog(3) logging priority. If less than 0, log message is multi-line
@param format_CF The format string (as a CFString for stdout/stderr)
@param log The os_log_t handle (for logging)
@param type The os_log_type_t type (for logging)
@param format The format string (for logging)
- @result The specified message will be written to the system message
- logger.
stream.
*/
void __SC_Log (int level,
/*!
@function SCPrint
@discussion Conditionally issue a debug message.
+ The message will be written to the specified output stream.
@param condition A boolean value indicating if the message should be written
@param stream The output stream for the log message.
@param formatString The format string
- @result The message will be written to the specified stream
- stream.
*/
void SCPrint (Boolean condition,
FILE *stream,
...) CF_FORMAT_FUNCTION(3, 4);
-
-/*!
- @function SCLoggerCreate
- @discussion Create a reference to logger which stores information like verbose mode or not, loggerID, etc.
- loggerID and moduleName both need to be non NULL, or else the function returns NULL.
- If the moduleName points to a module which doesn't exist, then SCLoggerCreate will fail and
- return NULL;
- @param loggerID CFStringRef which will be appended to the log message when in verbose mode. It will also be
- used to identify the module where the rules are being defined.
- */
-SCLoggerRef
-SCLoggerCreate (CFStringRef loggerID);
-
-/*!
- @function SCLoggerGetFlags
- @discussion Returns the log flags for the logging reference
- @param logger Reference which points to the logger information
- */
-SCLoggerFlags
-SCLoggerGetFlags (SCLoggerRef logger);
-
-/*!
- @function SCLoggerSetFlags
- @discussion Sets the log flags for the logger reference
- @param logger A reference to the logger
- @param flags SCLoggerFlags value determining where the logs from the logger will be directed
- */
-void SCLoggerSetFlags (SCLoggerRef logger,
- SCLoggerFlags flags);
-
#pragma mark -
#pragma mark Proxies
/*!
@function SCNetworkProxiesCopyMatching
- @discussion
+ @discussion Return the proxy configurations matching a target host
+ and/or one associated with a specific network interface.
@param globalConfiguration the proxy dictionary currently returned
by SCDynamicStoreCopyProxies().
@param server A CFString specying the hostname of interest; NULL if
/*!
@function SCNetworkProxiesCopyMatchingWithOptions
- @discussion
+ @discussion Return the proxy configurations matching a target host
+ and/or one associated with a specific network interface.
@param globalConfiguration the proxy dictionary currently returned
by SCDynamicStoreCopyProxies().
@param options A dictionary containing any (or none) of the following:
extern const CFStringRef kSCProxiesNoGlobal;
/*!
- @function SCNetworkProxiesCreateProxyAgentData
- @discussion
-
+ @function SCNetworkProxiesCreateProxyAgentData
+ @discussion Returns a serialized representation of a proxy configuration.
@param proxyConfig A dictionary representing a proxy configuration
- @result returns a CFData representing a proxy configuration. This data is readable by all
- "config-agents" (Agents with domain as "SystemConfig") via config_agent_copy_proxy_information().
- You must release the returned value.
+ @result returns a CFData representing a proxy configuration. This data is
+ readable by all "config-agents" (Agents with domain as "SystemConfig")
+ via config_agent_copy_proxy_information().
+ You must release the returned value.
*/
CFDataRef
SCNetworkProxiesCreateProxyAgentData(CFDictionaryRef proxyConfig) __OSX_AVAILABLE_STARTING(__MAC_10_12,__IPHONE_10_0/*SPI*/);
/*!
- @function SCDynamicStoreCopyProxiesWithOptions
- @discussion
-
+ @function SCDynamicStoreCopyProxiesWithOptions
+ @discussion Return the proxy configurations matching the provided
+ criteria.
@param store An SCDynamicStoreRef representing the dynamic store
session that should be used for communication with the server.
If NULL, a temporary session will be used.
const CFStringRef kSCEntNetEAPOL = CFSTR("EAPOL");
const CFStringRef kSCEntNetIPv4RouterARPFailure = CFSTR("IPv4RouterARPFailure");
const CFStringRef kSCEntNetIPv4RouterARPAlive = CFSTR("IPv4RouterARPAlive");
+const CFStringRef kSCEntNetIPv6RouterExpired = CFSTR("IPv6RouterExpired");
const CFStringRef kSCEntNetLinkIssues = CFSTR("LinkIssues");
const CFStringRef kSCEntNetLinkQuality = CFSTR("LinkQuality");
const CFStringRef kSCEntNetLoopback = CFSTR("Loopback");
+const CFStringRef kSCEntNetNAT64PrefixRequest = CFSTR("NAT64PrefixRequest");
const CFStringRef kSCEntNetOnDemand = CFSTR("OnDemand");
const CFStringRef kSCEntNetQoSMarkingPolicy = CFSTR("QoSMarkingPolicy");
const CFStringRef kSCEntNetService = CFSTR("__SERVICE__");
* kSCPropNetInterfaceHardware "Hardware" CFString
* kSCPropNetInterfaceType "Type" CFString
* kSCPropNetInterfaceSubType "SubType" CFString
- * kSCPropNetInterfaceSupportsModemOnHold "SupportsModemOnHold" CFNumber (0 or 1)
*
* --- kSCPropNetInterfaceType values ---
* kSCValNetInterfaceTypeEthernet "Ethernet"
@const kSCPropNetInterfaceSupportsModemOnHold
@discussion Value is a CFNumber (0 or 1)
*/
-extern const CFStringRef kSCPropNetInterfaceSupportsModemOnHold __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/);
+extern const CFStringRef kSCPropNetInterfaceSupportsModemOnHold __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2,__MAC_10_13,__IPHONE_2_0/*SPI*/,__IPHONE_FUTURE/*SPI*/);
#define kSCPropNetInterfaceSupportsModemOnHold kSCPropNetInterfaceSupportsModemOnHold
/*!
* kSCEntNetEAPOL "EAPOL" CFDictionary
* kSCEntNetIPv4RouterARPFailure "IPv4RouterARPFailure"
* kSCEntNetIPv4RouterARPAlive "IPv4RouterARPAlive"
+ * kSCEntNetIPv6RouterExpired "IPv6RouterExpired"
* kSCEntNetLinkIssues "LinkIssues" CFDictionary
* kSCEntNetLinkQuality "LinkQuality" CFDictionary
* kSCEntNetLoopback "Loopback" CFDictionary
+ * kSCEntNetNAT64PrefixRequest "NAT64PrefixRequest"
* kSCEntNetOnDemand "OnDemand" CFDictionary
* kSCEntNetQoSMarkingPolicy "QoSMarkingPolicy" CFDictionary
* kSCEntNetService "__SERVICE__" CFDictionary
extern const CFStringRef kSCEntNetIPv4RouterARPAlive __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0/*SPI*/);
#define kSCEntNetIPv4RouterARPAlive kSCEntNetIPv4RouterARPAlive
+/*!
+ @const kSCEntNetIPv6RouterExpired
+ */
+extern const CFStringRef kSCEntNetIPv6RouterExpired __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0/*SPI*/);
+#define kSCEntNetIPv6RouterExpired kSCEntNetIPv6RouterExpired
+
/*!
@const kSCEntNetLinkIssues
@discussion Value is a CFDictionary
extern const CFStringRef kSCEntNetLoopback __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/);
#define kSCEntNetLoopback kSCEntNetLoopback
+/*!
+ @const kSCEntNetNAT64PrefixRequest
+ */
+extern const CFStringRef kSCEntNetNAT64PrefixRequest __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0/*SPI*/);
+#define kSCEntNetNAT64PrefixRequest kSCEntNetNAT64PrefixRequest
+
/*!
@const kSCEntNetOnDemand
@discussion Value is a CFDictionary
@const kSCEntNetQoSMarkingPolicy
@discussion Value is a CFDictionary
*/
-extern const CFStringRef kSCEntNetQoSMarkingPolicy __OSX_AVAILABLE_STARTING(__MAC_10_12,__IPHONE_10_0/*SPI*/);
+extern const CFStringRef kSCEntNetQoSMarkingPolicy __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_10_0/*SPI*/);
#define kSCEntNetQoSMarkingPolicy kSCEntNetQoSMarkingPolicy
/*!
@const kSCPropNetQoSMarkingAppleAudioVideoCalls
@discussion Value is a CFBoolean
*/
-extern const CFStringRef kSCPropNetQoSMarkingAppleAudioVideoCalls __OSX_AVAILABLE_STARTING(__MAC_10_12,__IPHONE_10_0/*SPI*/);
+extern const CFStringRef kSCPropNetQoSMarkingAppleAudioVideoCalls __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_10_0/*SPI*/);
#define kSCPropNetQoSMarkingAppleAudioVideoCalls kSCPropNetQoSMarkingAppleAudioVideoCalls
/*!
@const kSCPropNetQoSMarkingEnabled
@discussion Value is a CFBoolean
*/
-extern const CFStringRef kSCPropNetQoSMarkingEnabled __OSX_AVAILABLE_STARTING(__MAC_10_12,__IPHONE_10_0/*SPI*/);
+extern const CFStringRef kSCPropNetQoSMarkingEnabled __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_10_0/*SPI*/);
#define kSCPropNetQoSMarkingEnabled kSCPropNetQoSMarkingEnabled
/*!
@const kSCPropNetQoSMarkingWhitelistedAppIdentifiers
@discussion Value is a CFArray[CFString]
*/
-extern const CFStringRef kSCPropNetQoSMarkingWhitelistedAppIdentifiers __OSX_AVAILABLE_STARTING(__MAC_10_12,__IPHONE_10_0/*SPI*/);
+extern const CFStringRef kSCPropNetQoSMarkingWhitelistedAppIdentifiers __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_10_0/*SPI*/);
#define kSCPropNetQoSMarkingWhitelistedAppIdentifiers kSCPropNetQoSMarkingWhitelistedAppIdentifiers
/*!
/*
- * Copyright (c) 2009-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2009-2017 Apple Inc. All rights reserved.
*/
/*
- * Copyright (c) 2012-2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2012-2015, 2017 Apple Inc. All rights reserved.
*/
/*
- * Copyright (c) 2009-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2009-2017 Apple Inc. All rights reserved.
*/
/*
- * Copyright (c) 2012, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2012, 2013, 2016, 2017 Apple Inc. All rights reserved.
*/
#include "SCNetworkConfigurationInternal.h"
copy_matching_services(SCPreferencesRef prefs, CFStringRef identifierDomain, CFStringRef identifier)
{
CFMutableArrayRef results = NULL;
- CFArrayRef services;
+ CFArrayRef services;
services = SCNetworkServiceCopyAll(prefs);
if (services != NULL) {
CFIndex service_count = CFArrayGetCount(services);
for (idx = 0; idx < service_count; idx++) {
- SCNetworkServiceRef service = CFArrayGetValueAtIndex(services, idx);
- Boolean matches = FALSE;
+ SCNetworkServiceRef service = CFArrayGetValueAtIndex(services, idx);
+ Boolean matches = FALSE;
if (isA_VPNService(service)) {
if (isA_CFString(identifierDomain) && isA_CFString(identifier)) {
if (check_for_apple_apps && CFStringHasPrefix(signingID, g_apple_app_prefix)) {
for (exception_idx = 0;
- exception_idx < sizeof(g_apple_app_exceptions) / sizeof(g_apple_app_exceptions[0]);
+ exception_idx < (CFIndex)(sizeof(g_apple_app_exceptions) / sizeof(g_apple_app_exceptions[0]));
exception_idx++)
{
if (CFStringCompare(signingID, g_apple_app_exceptions[exception_idx].signing_id, 0) == 0) {
CFArrayRef
VPNServiceCopyAppRuleIDs(VPNServiceRef service)
{
- CFMutableArrayRef results = NULL;
- CFDictionaryRef vpn_config;
+ SCNetworkInterfaceRef interface;
+ CFMutableArrayRef results = NULL;
+ CFDictionaryRef vpn_config;
if (!isA_VPNService(service)) {
_SCErrorSet(kSCStatusInvalidArgument);
return NULL;
}
- vpn_config = SCNetworkInterfaceGetConfiguration(SCNetworkServiceGetInterface(service));
+ interface = SCNetworkServiceGetInterface(service);
+ if (interface == NULL) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return NULL;
+ }
+ vpn_config = SCNetworkInterfaceGetConfiguration(interface);
if (isA_CFDictionary(vpn_config)) {
CFArrayRef app_rules = CFDictionaryGetValue(vpn_config, kSCPropNetVPNAppRules);
if (isA_CFArray(app_rules)) {
Boolean
VPNServiceSetAppRule(VPNServiceRef service, CFStringRef ruleIdentifier, CFDictionaryRef ruleSettings)
{
- CFArrayRef accounts;
- CFArrayRef app_rules;
- CFArrayRef executables;
- CFIndex existing_idx = -1;
- CFArrayRef match_domains;
- CFMutableArrayRef new_app_rules;
+ CFArrayRef accounts;
+ CFArrayRef app_rules;
+ CFArrayRef executables;
+ CFIndex existing_idx = -1;
+ SCNetworkInterfaceRef interface;
+ CFArrayRef match_domains;
+ CFMutableArrayRef new_app_rules;
CFMutableDictionaryRef new_settings;
CFMutableDictionaryRef new_vpn_config;
- CFDictionaryRef vpn_config;
+ CFDictionaryRef vpn_config;
/* Basic parameter validation */
return FALSE;
}
+ interface = SCNetworkServiceGetInterface(service);
+ if (interface == NULL) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return FALSE;
+ }
+
executables = CFDictionaryGetValue(ruleSettings, kSCValNetVPNAppRuleExecutableMatch);
match_domains = CFDictionaryGetValue(ruleSettings, kSCValNetVPNAppRuleDNSDomainMatch);
accounts = CFDictionaryGetValue(ruleSettings, kSCValNetVPNAppRuleAccountIdentifierMatch);
/* Set the new rule config, replacing any existing rule */
- vpn_config = SCNetworkInterfaceGetConfiguration(SCNetworkServiceGetInterface(service));
+ vpn_config = SCNetworkInterfaceGetConfiguration(interface);
if (isA_CFDictionary(vpn_config)) {
existing_idx = find_app_rule(vpn_config, ruleIdentifier);
new_vpn_config = CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, vpn_config);
} else {
new_vpn_config = CFDictionaryCreateMutable(kCFAllocatorDefault,
- 0,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
+ 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
}
app_rules = CFDictionaryGetValue(new_vpn_config, kSCPropNetVPNAppRules);
new_app_rules = CFArrayCreateMutableCopy(kCFAllocatorDefault, 0, app_rules);
} else {
new_app_rules = CFArrayCreateMutable(kCFAllocatorDefault,
- 0,
- &kCFTypeArrayCallBacks);
+ 0,
+ &kCFTypeArrayCallBacks);
}
new_settings = CFDictionaryCreateMutable(kCFAllocatorDefault,
- 0,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
+ 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue(new_settings, kSCValNetVPNAppRuleIdentifier, ruleIdentifier);
if (executables != NULL && CFArrayGetCount(executables) > 0) {
CFDictionarySetValue(new_vpn_config, kSCPropNetVPNAppRules, new_app_rules);
- SCNetworkInterfaceSetConfiguration(SCNetworkServiceGetInterface(service), new_vpn_config);
+ SCNetworkInterfaceSetConfiguration(interface, new_vpn_config);
CFRelease(new_vpn_config);
CFRelease(new_app_rules);
CFDictionaryRef
VPNServiceCopyAppRule(VPNServiceRef service, CFStringRef ruleIdentifier)
{
- CFDictionaryRef vpn_config;
+ SCNetworkInterfaceRef interface;
+ CFDictionaryRef vpn_config;
if (!isA_VPNService(service) || !isA_CFString(ruleIdentifier)) {
_SCErrorSet(kSCStatusInvalidArgument);
return NULL;
}
- vpn_config = SCNetworkInterfaceGetConfiguration(SCNetworkServiceGetInterface(service));
+ interface = SCNetworkServiceGetInterface(service);
+ if (interface == NULL) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return FALSE;
+ }
+
+ vpn_config = SCNetworkInterfaceGetConfiguration(interface);
if (isA_CFDictionary(vpn_config)) {
CFIndex idx = find_app_rule(vpn_config, ruleIdentifier);
if (idx >= 0) {
Boolean
VPNServiceRemoveAppRule(VPNServiceRef service, CFStringRef ruleIdentifier)
{
- CFDictionaryRef vpn_config;
+ SCNetworkInterfaceRef interface;
+ CFDictionaryRef vpn_config;
if (!isA_VPNService(service) || !isA_CFString(ruleIdentifier)) {
_SCErrorSet(kSCStatusInvalidArgument);
return FALSE;
}
- vpn_config = SCNetworkInterfaceGetConfiguration(SCNetworkServiceGetInterface(service));
+ interface = SCNetworkServiceGetInterface(service);
+ if (interface == NULL) {
+ _SCErrorSet(kSCStatusInvalidArgument);
+ return FALSE;
+ }
+
+ vpn_config = SCNetworkInterfaceGetConfiguration(interface);
if (isA_CFDictionary(vpn_config)) {
CFIndex idx = find_app_rule(vpn_config, ruleIdentifier);
if (idx >= 0) {
CFDictionaryRemoveValue(new_vpn_config, kSCPropNetVPNAppRules);
}
- SCNetworkInterfaceSetConfiguration(SCNetworkServiceGetInterface(service), new_vpn_config);
+ SCNetworkInterfaceSetConfiguration(interface, new_vpn_config);
CFRelease(new_vpn_config);
CFRelease(new_app_rules);
SC_10_5_10_7, // deprecated in 10.7
SC_10_1_10_9, // deprecated in 10.9
SC_10_2_10_9, // deprecated in 10.9
+ SC_10_2_10_13, // deprecated in 10.13
SC_10_3_10_9, // deprecated in 10.9
SC_10_4_10_9, // deprecated in 10.9
SC_10_6_IPHONE_2_0,
SC_10_10_IPHONE_8_0_PRIVATE,
SC_10_11_IPHONE_9_0_PRIVATE,
SC_10_12_IPHONE_10_0_PRIVATE,
+ SC_10_13_IPHONE_10_0_PRIVATE,
+ SC_10_13_IPHONE_11_0_PRIVATE,
SC_IPHONE_2_0_PRIVATE,
COMMENT_DEPRECATED,
GROUP_DEPRECATED,
#define EXCLUDESIMPLEHOSTNAMES "ExcludeSimpleHostnames"
#define EXECUTABLE "Executable"
#define EXPENSIVE "Expensive"
+#define EXPIRED "Expired"
#define EXTERNAL "External"
#define FAILOVER "Failover"
#define FAILURE "Failure"
#define MSCHAP2 "MSCHAP2"
#define MTU "MTU"
#define NAME "Name"
+#define NAT64 "NAT64"
#define NETBIOS "NetBIOS"
#define NETINFO "NetInfo"
#define NETWORK "Network"
#define PPPSERIAL "PPPSerial"
#define PPTP "PPTP"
#define PREFERRED "Preferred"
+#define PREFIX "Prefix"
#define PREFIXLENGTH "PrefixLength"
#define PREFS "Prefs"
#define PRIMARYINTERFACE "PrimaryInterface"
#define REMINDER "Reminder"
#define REMINDERTIME "ReminderTime"
#define REMOTEADDRESS "RemoteAddress"
+#define REQUEST "Request"
#define REQUESTED "Requested"
#define REQUIRED "Required"
#define REQUIREMENT "Requirement"
{ SC_10_5_PRIVATE, NETENT, EAPOL, NULL, CFDICTIONARY },
{ SC_10_10_IPHONE_8_0_PRIVATE, NETENT, IPV4 ROUTER ARP FAILURE, NULL, NULL},
{ SC_10_10_IPHONE_8_0_PRIVATE, NETENT, IPV4 ROUTER ARP ALIVE, NULL, NULL},
+ { SC_10_13_IPHONE_11_0_PRIVATE, NETENT, IPV6 ROUTER EXPIRED, NULL, NULL},
{ SC_10_9_IPHONE_7_0_PRIVATE, NETENT, LINKISSUES, NULL, CFDICTIONARY},
{ SC_10_7_IPHONE_5_0_PRIVATE, NETENT, LINKQUALITY, NULL, CFDICTIONARY},
{ SC_10_7_IPHONE_4_0_PRIVATE, NETENT, LOOPBACK, NULL, CFDICTIONARY },
+ { SC_10_13_IPHONE_11_0_PRIVATE, NETENT, NAT64 PREFIX REQUEST, NULL, NULL},
{ SC_10_6_IPHONE_3_0_PRIVATE, NETENT, ONDEMAND, NULL, CFDICTIONARY },
- { SC_10_12_IPHONE_10_0_PRIVATE, NETENT, QOSMARKING POLICY, NULL, CFDICTIONARY },
+ { SC_10_13_IPHONE_10_0_PRIVATE, NETENT, QOSMARKING POLICY, 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 },
{ SC_10_1, NETPROP INTERFACE, HARDWARE, NULL, CFSTRING },
{ SC_10_1, NETPROP INTERFACE, TYPE, NULL, CFSTRING },
{ SC_10_1, NETPROP INTERFACE, SUBTYPE, NULL, CFSTRING },
- { SC_10_2, NETPROP INTERFACE, SUPPORTSMODEMONHOLD, NULL, CFNUMBER_BOOL },
+ { SC_10_2_10_13, NETPROP INTERFACE, SUPPORTSMODEMONHOLD, NULL, CFNUMBER_BOOL },
{ COMMENT, "", NULL, NULL, NULL },
{ COMMENT, "--- " KEY_PREFIX NETPROP INTERFACE TYPE " values ---", NULL, NULL, NULL },
{ SC_10_1, NETVAL INTERFACE TYPE, ETHERNET, NULL, NULL },
{ GROUP_PRIVATE, NETPROP LINK, KEY_PREFIX NETENT QOSMARKING POLICY " Entity Keys", NULL, NULL },
- { SC_10_12_IPHONE_10_0_PRIVATE, NETPROP QOSMARKING, APPLE AUDIOVIDEOCALLS,
+ { SC_10_13_IPHONE_10_0_PRIVATE, NETPROP QOSMARKING, APPLE AUDIOVIDEOCALLS,
QOSMARKING APPLE AUDIOVIDEOCALLS,
CFBOOLEAN},
- { SC_10_12_IPHONE_10_0_PRIVATE, NETPROP QOSMARKING, ENABLED,
+ { SC_10_13_IPHONE_10_0_PRIVATE, NETPROP QOSMARKING, ENABLED,
QOSMARKING ENABLED,
CFBOOLEAN},
- { SC_10_12_IPHONE_10_0_PRIVATE, NETPROP QOSMARKING, WHITELISTED APP IDENTIFIERS,
+ { SC_10_13_IPHONE_10_0_PRIVATE, NETPROP QOSMARKING, WHITELISTED APP IDENTIFIERS,
QOSMARKING WHITELISTED APP IDENTIFIERS,
CFARRAY_CFSTRING},
{ COMMENT_PRIVATE, "", NULL, NULL, NULL },
case SC_10_2_10_9:
printf(" __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2,__MAC_10_9,__IPHONE_2_0/*SPI*/,__IPHONE_FUTURE/*SPI*/);\n");
break;
+ case SC_10_2_10_13:
+ printf(" __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2,__MAC_10_13,__IPHONE_2_0/*SPI*/,__IPHONE_FUTURE/*SPI*/);\n");
+ break;
case SC_10_3_10_9:
printf(" __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3,__MAC_10_9,__IPHONE_2_0/*SPI*/,__IPHONE_FUTURE/*SPI*/);\n");
break;
case SC_10_12_IPHONE_10_0_PRIVATE:
printf(" __OSX_AVAILABLE_STARTING(__MAC_10_12,__IPHONE_10_0/*SPI*/);\n");
break;
+ case SC_10_13_IPHONE_10_0_PRIVATE:
+ printf(" __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_10_0/*SPI*/);\n");
+ break;
+ case SC_10_13_IPHONE_11_0_PRIVATE:
+ printf(" __OSX_AVAILABLE_STARTING(__MAC_10_13,__IPHONE_11_0/*SPI*/);\n");
+ break;
case SC_IPHONE_2_0_PRIVATE:
printf(" __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_2_0/*SPI*/);\n");
break;
case SC_10_1_10_4:
case SC_10_1_10_9:
case SC_10_2_10_9:
+ case SC_10_2_10_13:
case SC_10_3_10_9:
case SC_10_4_10_9:
// don't report deprecated keys
case SC_10_10_IPHONE_8_0_PRIVATE:
case SC_10_11_IPHONE_9_0_PRIVATE:
case SC_10_12_IPHONE_10_0_PRIVATE:
+ case SC_10_13_IPHONE_10_0_PRIVATE:
+ case SC_10_13_IPHONE_11_0_PRIVATE:
case SC_IPHONE_2_0_PRIVATE:
// don't report private definitions
break;
case SC_10_1_10_4:
case SC_10_1_10_9:
case SC_10_2_10_9:
+ case SC_10_2_10_13:
case SC_10_3_10_9:
case SC_10_4_10_9:
// don't report deprecated keys
case SC_10_10_IPHONE_8_0_PRIVATE:
case SC_10_11_IPHONE_9_0_PRIVATE:
case SC_10_12_IPHONE_10_0_PRIVATE:
+ case SC_10_13_IPHONE_10_0_PRIVATE:
+ case SC_10_13_IPHONE_11_0_PRIVATE:
case SC_IPHONE_2_0_PRIVATE:
print_comment(&names[i]);
break;
case SC_10_10_IPHONE_8_0_PRIVATE:
case SC_10_11_IPHONE_9_0_PRIVATE:
case SC_10_12_IPHONE_10_0_PRIVATE:
+ case SC_10_13_IPHONE_10_0_PRIVATE:
+ case SC_10_13_IPHONE_11_0_PRIVATE:
case SC_IPHONE_2_0_PRIVATE:
// don't report private definitions
break;
case SC_10_10_IPHONE_8_0_PRIVATE:
case SC_10_11_IPHONE_9_0_PRIVATE:
case SC_10_12_IPHONE_10_0_PRIVATE:
+ case SC_10_13_IPHONE_10_0_PRIVATE:
+ case SC_10_13_IPHONE_11_0_PRIVATE:
case SC_IPHONE_2_0_PRIVATE:
print_headerdoc(&names[i]);
break;
/*
- * Copyright (c) 2005-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <Security/Security.h>
#include <Security/SecTask.h>
-#define SC_LOG_HANDLE __log_SCHelper()
+#define SC_LOG_HANDLE __log_SCHelper()
+#define SC_LOG_HANDLE_TYPE static
#include "SCPreferencesInternal.h"
#include "SCHelper_client.h"
#include "helper_types.h"
}
-static CFArrayRef
+static Boolean
__SCHelperSessionUseVPNFilter(SCHelperSessionRef session, CFArrayRef *vpnTypes)
{
SCHelperSessionPrivateRef sessionPrivate = (SCHelperSessionPrivateRef)session;
CFRelease(sessionPrivate);
return NULL;
}
+
+ pthread_mutex_lock(&sessionPrivate->lock);
sessionPrivate->callerReadAccess = UNKNOWN;
sessionPrivate->callerWriteAccess = UNKNOWN;
sessionPrivate->isSetChange = UNKNOWN;
sessionPrivate->isVPNChange = UNKNOWN;
+ pthread_mutex_unlock(&sessionPrivate->lock);
// keep track this session
pthread_mutex_lock(&sessions_lock);
snprintf(path,
sizeof(path),
- "/Library/Logs/CrashReporter/SCHelper-%4d-%02d-%02d-%02d%02d%02d.log",
+ _SC_CRASH_DIR "/" "SCHelper-%4d-%02d-%02d-%02d%02d%02d.log",
tm_now.tm_year + 1900,
tm_now.tm_mon + 1,
tm_now.tm_mday,
#pragma mark Helpers
+#define HELPER_STATUS_NO_REPLY UINT32_MAX
+
+
/*
* EXIT
* (in) data = N/A
static Boolean
do_Exit(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
- *status = -1;
+#pragma unused(session)
+#pragma unused(info)
+#pragma unused(data)
+#pragma unused(reply)
+ *status = HELPER_STATUS_NO_REPLY;
return FALSE;
}
static Boolean
do_Auth(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
+#pragma unused(reply)
CFDictionaryRef authorizationDict;
#if !TARGET_OS_IPHONE
CFDataRef authorizationData = NULL;
static Boolean
do_keychain_copy(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
Boolean ok = FALSE;
SCPreferencesRef prefs;
CFStringRef unique_id = NULL;
static Boolean
do_keychain_exists(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
+#pragma unused(reply)
Boolean ok = FALSE;
SCPreferencesRef prefs;
CFStringRef unique_id = NULL;
static Boolean
do_keychain_remove(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
+#pragma unused(reply)
Boolean ok = FALSE;
SCPreferencesRef prefs;
CFStringRef unique_id = NULL;
static Boolean
do_keychain_set(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
+#pragma unused(reply)
CFStringRef account;
CFStringRef description;
CFArrayRef executablePaths = NULL;
static Boolean
do_interface_refresh(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(session)
+#pragma unused(info)
+#pragma unused(reply)
CFStringRef ifName = NULL;
Boolean ok = FALSE;
static Boolean
do_prefs_Open(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
+#pragma unused(reply)
CFStringRef name;
CFDictionaryRef options;
CFNumberRef pid;
static Boolean
do_prefs_Access(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
+#pragma unused(data)
Boolean ok;
SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session);
CFDataRef signature;
static Boolean
do_prefs_Lock(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(reply)
CFDataRef clientSignature = (CFDataRef)data;
Boolean ok;
SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session);
static Boolean
do_prefs_Commit(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
Boolean ok;
SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session);
CFPropertyListRef prefsData = NULL;
static Boolean
do_prefs_Apply(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
+#pragma unused(data)
+#pragma unused(reply)
Boolean ok;
SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session);
static Boolean
do_prefs_Unlock(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
+#pragma unused(data)
+#pragma unused(reply)
Boolean ok;
SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session);
static Boolean
do_prefs_Close(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
+#pragma unused(data)
+#pragma unused(reply)
SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session);
if (prefs == NULL) {
}
__SCHelperSessionSetPreferences(session, NULL);
- *status = -1;
+ *status = HELPER_STATUS_NO_REPLY;
return TRUE;
}
static Boolean
do_prefs_Synchronize(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
{
+#pragma unused(info)
+#pragma unused(data)
+#pragma unused(reply)
SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session);
if (prefs == NULL) {
static int
-findCommand(uint32_t command)
+findCommand(int command)
{
- int i;
-
- for (i = 0; i < (int)nHELPERS; i++) {
+ for (int i = 0; i < (int)nHELPERS; i++) {
if (helpers[i].command == command) {
return i;
}
static void *
newHelper(void *arg)
{
+ int ret;
CFRunLoopSourceRef rls = NULL;
SCHelperSessionRef session = (SCHelperSessionRef)arg;
SCHelperSessionPrivateRef sessionPrivate = (SCHelperSessionPrivateRef)session;
__SCHelperSessionSetThreadName(session);
+ ret = pthread_set_qos_class_self_np(QOS_CLASS_USER_INITIATED, 0);
+ if (ret != 0) {
+ SC_log(LOG_ERR, "pthread_set_qos_class_self_np() failed: %s", strerror(errno));
+ }
+
rls = CFMachPortCreateRunLoopSource(NULL, sessionPrivate->mp, 0);
CFRelease(sessionPrivate->mp);
static void
helperCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
{
+#pragma unused(port)
+#pragma unused(size)
+#pragma unused(info)
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;
+ static size_t bufSize = 0;
mach_msg_return_t mr;
int options;
static CFStringRef
initMPCopyDescription(const void *info)
{
+#pragma unused(info)
return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SCHelper MP>"));
}
(*helpers[i].func)(session, helpers[i].info, data, status, &reply);
}
- if ((*status != -1) || (reply != NULL)) {
+ if ((*status != HELPER_STATUS_NO_REPLY) || (reply != NULL)) {
Boolean ok;
SC_log(LOG_INFO, "%p : sending status %u%s",
static CFStringRef
helperMPCopyDescription(const void *info)
{
+#pragma unused(info)
return CFStringCreateWithFormat(NULL, NULL, CFSTR("<main SCHelper MP>"));
}
// extern int optind;
int opt;
int opti;
+ int ret;
openlog("SCHelper", LOG_CONS|LOG_PID, LOG_DAEMON);
pthread_setname_np("SCHelper main thread");
+ ret = pthread_set_qos_class_self_np(QOS_CLASS_USER_INITIATED, 0);
+ if (ret != 0) {
+ SC_log(LOG_ERR, "pthread_set_qos_class_self_np() failed: %s", strerror(errno));
+ }
+
while (!done) {
SInt32 rlStatus;
int gen_current;
<true/>
</dict>
<key>POSIXSpawnType</key>
- <string>Adaptive</string>
+ <string>Interactive</string>
</dict>
</plist>
<true/>
</dict>
<key>POSIXSpawnType</key>
- <string>Adaptive</string>
+ <string>Interactive</string>
</dict>
</plist>
/*
- * Copyright (c) 2012, 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2012, 2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
&token,
prefs_observer_queue,
^(int token) {
+#pragma unused(token)
prefs_observer_handle_notifications();
});
if (status != NOTIFY_STATUS_OK) {
dispatch_queue_t q1 = dispatch_queue_create("com.apple.SystemConfiguration.PrefsObserver.testQ1", NULL);
dispatch_block_t b1 = ^{
- printf("Block 1 executed \n");
+ printf("Block 1 executed\n");
};
dispatch_queue_t q2 = dispatch_queue_create("com.apple.SystemConfiguration.PrefsObserver.testQ2", NULL);
dispatch_block_t b2 = ^{
- printf("Block 2 executed \n");
+ printf("Block 2 executed\n");
};
dispatch_queue_t q3 = dispatch_queue_create("com.apple.SystemConfiguration.PrefsObserver.testQ2", NULL);
dispatch_block_t b3 = ^{
- printf("Block 3 executed \n");
+ printf("Block 3 executed\n");
};
__block scprefs_observer_t observer1 = _scprefs_observer_watch(scprefs_observer_type_mcx, "com.apple.SystemConfiguration", q1, b1);
/*
- * Copyright (c) 2012-2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2012-2014, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
@discussion Sends a notification to interested configuration agents
when a particular preference file has changed.
@param type the type of preference (MCX on OSX, Global/Profiles on iOS) to watch.
- @param plist the name of the plist file to watch.
+ @param plist_name the name of the plist file to watch.
@param queue the queue to be called back on.
@param block the block to be called back on.
@result Returns the created preferences observer
/*
- * Copyright (c) 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
if (xpc_get_type(info) == XPC_TYPE_ARRAY) {
xpc_array_apply(info, ^bool(size_t index, xpc_object_t value) {
+#pragma unused(index)
if (value && xpc_get_type(value) == XPC_TYPE_DICTIONARY) {
agent_uuid = xpc_dictionary_get_value(info,
kConfigAgentOutOfBandDataUUID);
/*
- * Copyright (c) 2000, 2001, 2003-2005, 2009, 2011, 2012, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2009, 2011, 2012, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
storePrivate = (SCDynamicStorePrivateRef)theSession->store;
/*
- * deliver notifications to client sessions
+ * deliver [CFRunLoop/dispatch] notifications to client sessions
*/
if ((storePrivate->notifyStatus == Using_NotifierInformViaMachPort) &&
(storePrivate->notifyPort != MACH_PORT_NULL)) {
/*
- * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2008, 2011, 2012, 2014-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2008, 2011, 2012, 2014-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
}
}
- if (!hasWriteAccess(mySession, key)) {
+ if (!hasWriteAccess(mySession, "add", key)) {
*sc_status = kSCStatusAccessError;
goto done;
}
goto done;
}
- if (!hasWriteAccess(mySession, key)) {
+ if (!hasWriteAccess(mySession, "add (session)", key)) {
*sc_status = kSCStatusAccessError;
goto done;
}
/*
- * Copyright (c) 2000-2004, 2006, 2008, 2011, 2012, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008, 2011, 2012, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
}
}
- if (!hasWriteAccess(mySession, key)) {
+ if (!hasWriteAccess(mySession, "notify", key)) {
*sc_status = kSCStatusAccessError;
goto done;
}
/*
- * Copyright (c) 2000-2009, 2011, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009, 2011, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static CFStringRef
openMPCopyDescription(const void *info)
{
+#pragma unused(info)
return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SCDynamicStore MP>"));
}
/*
- * Copyright (c) 2000-2004, 2006, 2008, 2011, 2012, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008, 2011, 2012, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
}
}
- if (!hasWriteAccess(mySession, key)) {
+ if (!hasWriteAccess(mySession, "remove", key)) {
*sc_status = kSCStatusAccessError;
goto done;
}
/*
- * Copyright (c) 2000-2004, 2006, 2008, 2011, 2012, 2014-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008, 2011, 2012, 2014-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
int *sc_status,
audit_token_t audit_token)
{
+#pragma unused(oldInstance)
CFDataRef data = NULL; /* data (un-serialized) */
CFStringRef key = NULL; /* key (un-serialized) */
serverSessionRef mySession;
}
}
- if (!hasWriteAccess(mySession, key)) {
+ if (!hasWriteAccess(mySession, "set", key)) {
*sc_status = kSCStatusAccessError;
goto done;
}
CFStringRef key;
key = (CFStringRef)keys[i];
- if (!hasWriteAccess(mySession, key)) {
+ if (!hasWriteAccess(mySession, "set (multiple)", key)) {
writeOK = FALSE;
break;
}
CFStringRef key;
key = CFArrayGetValueAtIndex(remove, i);
- if (!hasWriteAccess(mySession, key)) {
+ if (!hasWriteAccess(mySession, "set/remove (multiple)", key)) {
*sc_status = kSCStatusAccessError;
goto done;
}
CFStringRef key;
key = CFArrayGetValueAtIndex(notify, i);
- if (!hasWriteAccess(mySession, key)) {
+ if (!hasWriteAccess(mySession, "set/notify (multiple)", key)) {
*sc_status = kSCStatusAccessError;
goto done;
}
/*
- * Copyright (c) 2000-2004, 2006, 2011, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2011, 2015, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static void
_cleanupRemovedSessionKeys(const void *value, void *context)
{
+#pragma unused(context)
CFStringRef removedKey = (CFStringRef)value;
CFRange dRange;
CFStringRef sessionKey;
/*
- * Copyright (c) 2000-2006, 2009-2011, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2009-2011, 2015, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
int
__SCDynamicStoreSnapshot(SCDynamicStoreRef store)
{
+#pragma unused(store)
CFDictionaryRef expandedStoreData;
FILE *f;
int fd;
/*
- * Copyright (c) 2000-2011, 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2011, 2013-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static void
term(CFMachPortRef port, void *msg, CFIndex size, void *info)
{
+#pragma unused(port)
+#pragma unused(msg)
+#pragma unused(size)
+#pragma unused(info)
int status = EX_OK;
Boolean wait;
static void
parent_exit(int i)
{
+#pragma unused(i)
_exit (0);
}
static CFStringRef
termMPCopyDescription(const void *info)
{
+#pragma unused(info)
return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SIGTERM MP>"));
}
/*
- * Copyright (c) 2000-2011, 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2011, 2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
void
configdCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
{
+#pragma unused(port)
+#pragma unused(size)
+#pragma unused(info)
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;
+ static size_t bufSize = 0;
mach_msg_return_t mr;
int options;
static CFStringRef
serverMPCopyDescription(const void *info)
{
+#pragma unused(info)
return CFStringCreateWithFormat(NULL, NULL, CFSTR("<main DynamicStore MP>"));
}
<true/>
<key>com.apple.security.network.server</key>
<true/>
- <key>com.apple.springboard.launchapplications</key>
- <true/>
<key>com.apple.wifi.manager-access</key>
<true/>
<key>com.apple.wlan.authentication</key>
<true/>
<key>com.apple.networkd.modify_settings</key>
<true/>
+ <key>com.apple.frontboard.launchapplications</key>
+ <true/>
</dict>
</plist>
/*
- * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include "configd.h"
#include "configd_server.h"
#include <SystemConfiguration/SCDPlugin.h>
-#include "SCNetworkReachabilityInternal.h"
void _SCDPluginExecInit();
PLUGIN_ALL ("com.apple.SystemConfiguration.InterfaceNamer"),
PLUGIN_ALL ("com.apple.SystemConfiguration.KernelEventMonitor"),
PLUGIN_ALL ("com.apple.SystemConfiguration.LinkConfiguration"),
- PLUGIN_ALL ("com.apple.SystemConfiguration.Logger"),
PLUGIN_ALL ("com.apple.SystemConfiguration.PPPController"),
PLUGIN_ALL ("com.apple.SystemConfiguration.PreferencesMonitor"),
- PLUGIN_IOS ("com.apple.SystemConfiguration.QoSMarking"),
+ PLUGIN_ALL ("com.apple.SystemConfiguration.QoSMarking"),
PLUGIN_MACOSX("com.apple.print.notification"),
};
#define N_PLUGIN_WHITELIST (sizeof(pluginWhitelist) / sizeof(pluginWhitelist[0]))
extern SCDynamicStoreBundleLoadFunction load_LinkConfiguration;
extern SCDynamicStoreBundleLoadFunction load_PreferencesMonitor;
extern SCDynamicStoreBundlePrimeFunction prime_PreferencesMonitor;
-#if TARGET_OS_IPHONE
extern SCDynamicStoreBundleLoadFunction load_QoSMarking;
-#endif // TARGET_OS_IPHONE
#endif // !TARGET_OS_SIMULATOR
&prime_PreferencesMonitor,
NULL
},
-#if TARGET_OS_IPHONE
{
CFSTR("com.apple.SystemConfiguration.QoSMarking"),
&load_QoSMarking,
NULL,
NULL
},
-#endif // TARGET_OS_IPHONE
#endif // !TARGET_OS_SIMULATOR
};
}
if (bundleInfo->builtin) {
- int i;
-
SC_log(LOG_INFO, "adding %@", bundleID);
- for (i = 0; i < sizeof(builtin_plugins)/sizeof(builtin_plugins[0]); i++) {
+ for (size_t i = 0; i < sizeof(builtin_plugins)/sizeof(builtin_plugins[0]); i++) {
if (CFEqual(bundleID, builtin_plugins[i].bundleID)) {
bundleInfo->load = builtin_plugins[i].load;
bundleInfo->start = builtin_plugins[i].start;
void
-callLoadFunction(const void *value, void *context) {
+callLoadFunction(const void *value, void *context)
+{
+#pragma unused(context)
bundleInfoRef bundleInfo = (bundleInfoRef)value;
if (!bundleInfo->loaded) {
void
-callStartFunction(const void *value, void *context) {
+callStartFunction(const void *value, void *context)
+{
+#pragma unused(context)
const char *bundleDirName;
bundleInfoRef bundleInfo = (bundleInfoRef)value;
char bundleName[MAXNAMLEN + 1];
void
-callPrimeFunction(const void *value, void *context) {
+callPrimeFunction(const void *value, void *context)
+{
+#pragma unused(context)
bundleInfoRef bundleInfo = (bundleInfoRef)value;
if (!bundleInfo->loaded) {
static void
stopDelayed(CFRunLoopTimerRef timer, void *info)
{
+#pragma unused(timer)
+#pragma unused(info)
const void **keys;
CFIndex i;
CFIndex n;
static void
-stopBundle(const void *value, void *context) {
+stopBundle(const void *value, void *context)
+{
+#pragma unused(context)
bundleInfoRef bundleInfo = (bundleInfoRef)value;
CFRunLoopSourceRef stopRls;
CFRunLoopSourceContext stopContext = { 0 // version
static CFStringRef
termRLSCopyDescription(const void *info)
{
+#pragma unused(info)
return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SIGTERM RLS>"));
}
void *
plugin_exec(void *arg)
{
- int i;
CFIndex nLoaded = 0;
/* keep track of bundles */
allBundles = CFArrayCreateMutable(NULL, 0, NULL);
/* add white-listed plugins to those we'll allow to be loaded */
- for (i = 0; i < N_PLUGIN_WHITELIST; i++) {
+ for (size_t i = 0; i < N_PLUGIN_WHITELIST; i++) {
if (pluginWhitelist[i] != NULL) {
CFSetSetValue(_plugins_allowed, pluginWhitelist[i]);
}
* Since xpcd calls getpwuid_r() during its initialization, it will
* block until the platform UUID is available.
*/
- for (i = 0; i < CFArrayGetCount(allBundles); i++) {
+ for (CFIndex i = 0; i < CFArrayGetCount(allBundles); i++) {
bundleInfoRef bi = (bundleInfoRef)CFArrayGetValueAtIndex(allBundles, i);
CFStringRef bundleID = CFBundleGetIdentifier(bi->bundle);
/*
- * Copyright (c) 2000, 2001, 2003-2005, 2007-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
bzero(&opts, sizeof(opts));
opts.flags = MPO_CONTEXT_AS_GUARD;
- kr = mach_port_construct(mach_task_self(), &opts, newSession, &mp);
+ kr = mach_port_construct(mach_task_self(), &opts, (mach_port_context_t)newSession, &mp);
#else // HAVE_MACHPORT_GUARDS
kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &mp);
#endif // HAVE_MACHPORT_GUARDS
* Our send right has already been removed. Remove our receive right.
*/
#ifdef HAVE_MACHPORT_GUARDS
- (void) mach_port_destruct(mach_task_self(), server, 0, thisSession);
+ (void) mach_port_destruct(mach_task_self(), server, 0, (mach_port_context_t)thisSession);
#else // HAVE_MACHPORT_GUARDS
(void) mach_port_mod_refs(mach_task_self(), server, MACH_PORT_RIGHT_RECEIVE, -1);
#endif // HAVE_MACHPORT_GUARDS
return (session->callerRootAccess == YES) ? TRUE : FALSE;
#else // !TARGET_OS_SIMULATOR
+#pragma unused(session)
/*
* assume that all processes interacting with
__private_extern__
Boolean
-hasWriteAccess(serverSessionRef session, CFStringRef key)
+hasWriteAccess(serverSessionRef session, const char *op, CFStringRef key)
{
Boolean isSetup;
* general, this is unwise and we should at the
* very least complain.
*/
- SC_log(LOG_NOTICE, "*** Non-configd process (pid=%d) attempting to modify \"%@\" ***",
+ SC_log(LOG_NOTICE, "*** Non-configd process (pid=%d) attempting to %s \"%@\" ***",
pid,
+ op,
key);
}
/*
- * Copyright (c) 2000, 2001, 2005-2007, 2009-2012, 2014, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2005-2007, 2009-2012, 2014, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
Boolean hasRootAccess (serverSessionRef session);
Boolean hasWriteAccess (serverSessionRef session,
+ const char *op,
CFStringRef key);
Boolean hasPathAccess (serverSessionRef session,
buildPhases = (
);
dependencies = (
+ 15631D111ECF92E70088EEDD /* PBXTargetDependency */,
72C4A4801BE44D19009D570E /* PBXTargetDependency */,
1558480607550D470046C2E9 /* PBXTargetDependency */,
1558480807550D470046C2E9 /* PBXTargetDependency */,
D6DDAC3D147A24BC00A2E902 /* PBXTargetDependency */,
- 72C12CB11D6EA2CA000EE61C /* PBXTargetDependency */,
150ECB300D0042DA0065E94D /* PBXTargetDependency */,
+ 72C12CB11D6EA2CA000EE61C /* PBXTargetDependency */,
);
name = configd_executables;
productName = configd_executables;
};
+ 15631D161ECF98FB0088EEDD /* configd_executables-EmbeddedSimulator */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 15631D231ECF98FB0088EEDD /* Build configuration list for PBXAggregateTarget "configd_executables-EmbeddedSimulator" */;
+ buildPhases = (
+ );
+ dependencies = (
+ 15631D271ECF99800088EEDD /* PBXTargetDependency */,
+ 15631D291ECF99800088EEDD /* PBXTargetDependency */,
+ 15631D2B1ECF99800088EEDD /* PBXTargetDependency */,
+ );
+ name = "configd_executables-EmbeddedSimulator";
+ productName = configd_executables;
+ };
157BB8AE075924360025DA7A /* configd_base */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 156EB5E60905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_base" */;
);
dependencies = (
158317120CFB77E1006F62B9 /* PBXTargetDependency */,
- 158317140CFB77E8006F62B9 /* PBXTargetDependency */,
);
name = "configd_base-Embedded";
productName = Frameworks;
buildPhases = (
);
dependencies = (
+ 15631D131ECF93040088EEDD /* PBXTargetDependency */,
158317660CFB80D5006F62B9 /* PBXTargetDependency */,
157434210D4A8166002ACA73 /* PBXTargetDependency */,
1574341F0D4A815E002ACA73 /* PBXTargetDependency */,
+ 1523BBE21E075859006281F1 /* PBXTargetDependency */,
7271EA341D7660980055B1AA /* PBXTargetDependency */,
);
name = "configd_executables-Embedded";
158AD98C0754E72500124717 /* PBXTargetDependency */,
159D542C07528E85004F8947 /* PBXTargetDependency */,
158AD98E0754E72500124717 /* PBXTargetDependency */,
+ 155F49A91C8650E900E47D08 /* PBXTargetDependency */,
+ 155F49AB1C8650E900E47D08 /* PBXTargetDependency */,
);
name = configd_plugins;
productName = Plugins;
isa = PBXAggregateTarget;
buildConfigurationList = 15C64A270F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem" */;
buildPhases = (
- 1502C5611BDD4936005CF7EA /* Move libsystem_configuration_asan.dylib */,
+ 1502C5611BDD4936005CF7EA /* Move libsystem_configuration_(asan|tsan).dylib */,
);
dependencies = (
15C64A220F684C4900D78394 /* PBXTargetDependency */,
isa = PBXAggregateTarget;
buildConfigurationList = 15C64A2B0F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem-Embedded" */;
buildPhases = (
- 15AC9A4C1BE3ED87003071BD /* Move libsystem_configuration_asan.dylib */,
+ 15AC9A4C1BE3ED87003071BD /* Move libsystem_configuration_(asan|tsan).dylib */,
);
dependencies = (
15C64A310F684C8F00D78394 /* PBXTargetDependency */,
dependencies = (
157FDE44164A079B0040D6A8 /* PBXTargetDependency */,
151FE37A0D5B713C000D6DB1 /* PBXTargetDependency */,
+ 15631D2D1ECF99A00088EEDD /* PBXTargetDependency */,
);
name = "All-EmbeddedSimulator";
productName = EmbeddedSimulator;
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
+ 1501F7691EA80189006A71B0 /* nat64-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15812A2D1EA5540B001CF384 /* nat64-configuration.c */; };
+ 1501F76A1EA8019D006A71B0 /* nat64-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15812A2D1EA5540B001CF384 /* nat64-configuration.c */; };
+ 1505A8D81EC3E1470089FC6A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 725CB7541BF439C6000C05A8 /* Foundation.framework */; };
15060818075A00A300B147BA /* SCSchemaDefinitions.c in Sources */ = {isa = PBXBuildFile; fileRef = 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */; };
1506081A075A00A300B147BA /* SCSchemaDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; };
150BEC1814CA24F900237116 /* dnsinfo_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0D05FD1B670096477F /* dnsinfo_server.c */; };
150BEC1A14CA252200237116 /* dnsinfo_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0D05FD1B670096477F /* dnsinfo_server.c */; };
150D7E1E0D16DC6C00AF4BED /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
+ 151D060E1EC14C8600E02E48 /* liblog_SystemConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 151D060D1EC14C6700E02E48 /* liblog_SystemConfiguration.m */; };
1520A3870846829A0010B584 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
1520A3DF0846B2DD0010B584 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
1522FCFB0FA7FE4B00B24128 /* dnsinfo_flatfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 1522FCE50FA7FD7000B24128 /* dnsinfo_flatfile.c */; };
153ACCA914E322D5005029A5 /* network_information_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 153ACCA614E322D5005029A5 /* network_information_server.c */; };
153ACCAB14E322D5005029A5 /* network_information_server.h in Headers */ = {isa = PBXBuildFile; fileRef = 153ACCA714E322D5005029A5 /* network_information_server.h */; };
153ACCAC14E322D5005029A5 /* network_information_server.h in Headers */ = {isa = PBXBuildFile; fileRef = 153ACCA714E322D5005029A5 /* network_information_server.h */; };
+ 153E16A51EE500810027698E /* SCNetworkReachabilityInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C330D0134B95AA0028E36B /* SCNetworkReachabilityInternal.h */; };
+ 153E16A61EE5008A0027698E /* SCNetworkReachabilityInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C330D0134B95AA0028E36B /* SCNetworkReachabilityInternal.h */; };
+ 153E16A71EE5008F0027698E /* SCNetworkReachabilityInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C330D0134B95AA0028E36B /* SCNetworkReachabilityInternal.h */; };
+ 153E16A81EE500E70027698E /* SCNetworkReachabilityInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C330D0134B95AA0028E36B /* SCNetworkReachabilityInternal.h */; };
+ 153E16A91EE500ED0027698E /* SCNetworkReachabilityInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C330D0134B95AA0028E36B /* SCNetworkReachabilityInternal.h */; };
+ 153E16AA1EE500EF0027698E /* SCNetworkReachabilityInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C330D0134B95AA0028E36B /* SCNetworkReachabilityInternal.h */; };
1540E3610987DA9500157C07 /* com.apple.configd.plist in Copy Files */ = {isa = PBXBuildFile; fileRef = 1540E3600987DA9500157C07 /* com.apple.configd.plist */; };
154361E00752C81800A8EC6C /* set-hostname.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AB07528B36004F8947 /* set-hostname.c */; };
1543636B0752D03C00A8EC6C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
154707300D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; };
154707350D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; };
154CF3F407E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 154FD13B1EC4062C00EDA8B9 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72573D331D66800C004975AD /* SystemConfiguration.framework */; };
155281020E3E4A0F00C54315 /* ip_plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53A707528B36004F8947 /* ip_plugin.c */; };
155847470754FDCD0046C2E9 /* scutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4305C0722B0099E85F /* scutil.h */; };
155847480754FDCD0046C2E9 /* commands.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4505C0722B0099E85F /* commands.h */; };
15C330D3134B95AA0028E36B /* SCNetworkReachabilityInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C330D0134B95AA0028E36B /* SCNetworkReachabilityInternal.h */; };
15C8C6BF170AAB4E005375CE /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; };
15C8C6C0170AAB4E005375CE /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53CB07528B36004F8947 /* cache.h */; };
+ 15CB8F701EE4DCFC00726685 /* network_state_information_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */; };
+ 15CB8F711EE4DCFF00726685 /* network_state_information_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */; };
+ 15CB8F721EE4DD0400726685 /* network_state_information_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */; };
+ 15CB8F731EE4DD0B00726685 /* network_state_information_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */; };
+ 15CB8F741EE4DD1000726685 /* network_state_information_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */; };
+ 15CB8F751EE4DD1100726685 /* network_state_information_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */; };
+ 15CB8F761EE4DD1600726685 /* network_state_information_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */; };
+ 15CB8F771EE4DD1900726685 /* network_state_information_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */; };
+ 15CB8F781EE4DD1B00726685 /* network_state_information_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */; };
+ 15CB8F791EE4DD3B00726685 /* dnsinfo_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */; };
+ 15CB8F7A1EE4DD3E00726685 /* dnsinfo_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */; };
+ 15CB8F7B1EE4DD3F00726685 /* dnsinfo_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */; };
+ 15CB8F7C1EE4DD4300726685 /* dnsinfo_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */; };
+ 15CB8F7D1EE4DD4600726685 /* dnsinfo_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */; };
+ 15CB8F7E1EE4DD4800726685 /* dnsinfo_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */; };
+ 15CB8F7F1EE4DD4B00726685 /* dnsinfo_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */; };
+ 15CB8F801EE4DD4D00726685 /* dnsinfo_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */; };
+ 15CB8F811EE4DD4E00726685 /* dnsinfo_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */; };
+ 15CB8F821EE4DE1F00726685 /* SCNetworkReachabilityLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */; };
+ 15CB8F831EE4DE2200726685 /* SCNetworkReachabilityLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */; };
+ 15CB8F841EE4DE2600726685 /* SCNetworkReachabilityLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */; };
+ 15CB8F851EE4DE2B00726685 /* SCNetworkReachabilityLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */; };
+ 15CB8F861EE4DE2E00726685 /* SCNetworkReachabilityLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */; };
+ 15CB8F871EE4DE3000726685 /* SCNetworkReachabilityLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */; };
+ 15CB8F881EE4DE3300726685 /* SCNetworkReachabilityLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */; };
+ 15CB8F891EE4DE3600726685 /* SCNetworkReachabilityLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */; };
+ 15CB8F8A1EE4DE3B00726685 /* SCNetworkReachabilityLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */; };
15D2E437167643460078F547 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
15D3083916F3EB8600014F82 /* simulator_support.c in Sources */ = {isa = PBXBuildFile; fileRef = 15D3083816F3EB8600014F82 /* simulator_support.c */; };
15D3083B16F4E81C00014F82 /* com.apple.configd_sim.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15D3083A16F4E6D900014F82 /* com.apple.configd_sim.plist */; };
15E1B05416EBAE3C00E5F06F /* scprefs_observer.c in Sources */ = {isa = PBXBuildFile; fileRef = D61AAEAD1522C99C0066B003 /* scprefs_observer.c */; };
15E1B05516EBAE3C00E5F06F /* IPMonitorControlPrefs.c in Sources */ = {isa = PBXBuildFile; fileRef = F9A3780E16A4846E00C57CDC /* IPMonitorControlPrefs.c */; };
15F21618110F823500E89CF7 /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15BAA32207F0699A00D9EC95 /* libbsm.dylib */; };
+ 15F742DD1EC6370000DA2E7A /* liblog_SystemConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 151D060D1EC14C6700E02E48 /* liblog_SystemConfiguration.m */; };
+ 15F742DF1EC6370000DA2E7A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 725CB7541BF439C6000C05A8 /* Foundation.framework */; };
+ 15F742E01EC6370000DA2E7A /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72573D331D66800C004975AD /* SystemConfiguration.framework */; };
+ 15F742EA1EC638D100DA2E7A /* liblog_SystemConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 151D060D1EC14C6700E02E48 /* liblog_SystemConfiguration.m */; };
+ 15F742EC1EC638D100DA2E7A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 725CB7541BF439C6000C05A8 /* Foundation.framework */; };
+ 15F742ED1EC638D100DA2E7A /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72573D331D66800C004975AD /* SystemConfiguration.framework */; };
15FB1F8A1E27EA8700B4F809 /* InterfaceNamerControlPrefs.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FB1F881E27E9A000B4F809 /* InterfaceNamerControlPrefs.c */; };
15FB1F8B1E27EA8900B4F809 /* InterfaceNamerControlPrefs.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FB1F881E27E9A000B4F809 /* InterfaceNamerControlPrefs.c */; };
15FBB54C17D6834C0035D752 /* libCrashReporterClient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15FBB54B17D6834C0035D752 /* libCrashReporterClient.a */; };
remoteGlobalIDString = 151FE2DD0D5B7046000D6DB1;
remoteInfo = "configd_base-EmbeddedSimulator";
};
+ 1523BBE11E075859006281F1 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 158337990CFB6B9E0033AB93;
+ remoteInfo = "SCHelper-Embedded";
+ };
1558480507550D470046C2E9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
remoteGlobalIDString = 155847FA07550D210046C2E9;
remoteInfo = configd_executables;
};
+ 155F49A81C8650E900E47D08 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 155F49861C864F1400E47D08;
+ remoteInfo = QoSMarking;
+ };
+ 155F49AA1C8650E900E47D08 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 155F498E1C864F3700E47D08;
+ remoteInfo = QoSMarking.bundle;
+ };
155F49AC1C86511300E47D08 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
remoteGlobalIDString = 155F499D1C864F5400E47D08;
remoteInfo = "QoSMarking.bundle-Embedded";
};
+ 15631D101ECF92E70088EEDD /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 151D05FA1EC1491600E02E48;
+ remoteInfo = liblog_SystemConfiguration;
+ };
+ 15631D121ECF93040088EEDD /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 15F742DA1EC6370000DA2E7A;
+ remoteInfo = "liblog_SystemConfiguration-Embedded";
+ };
+ 15631D261ECF99800088EEDD /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 15F742E71EC638D100DA2E7A;
+ remoteInfo = "liblog_SystemConfiguration-EmbeddedSimulator";
+ };
+ 15631D281ECF99800088EEDD /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 15732A7616EA503200F3AC4C;
+ remoteInfo = "configd-EmbeddedSimulator";
+ };
+ 15631D2A1ECF99800088EEDD /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 15732AAD16EA511900F3AC4C;
+ remoteInfo = "scutil-EmbeddedSimulator";
+ };
+ 15631D2C1ECF99A00088EEDD /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 15631D161ECF98FB0088EEDD;
+ remoteInfo = "configd_executables-EmbeddedSimulator";
+ };
15732AE516EA6BCE00F3AC4C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
remoteGlobalIDString = 1572C4A60CFB55B400E2776E;
remoteInfo = "SystemConfiguration.framework-Embedded";
};
- 158317130CFB77E8006F62B9 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 158337990CFB6B9E0033AB93;
- remoteInfo = "SCHelper-Embedded";
- };
158317150CFB783B006F62B9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
150607BD075A00A200B147BA /* SCSchemaDefinitions.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCSchemaDefinitions.c; sourceTree = "<group>"; };
150607DE075A00A300B147BA /* SCSchemaDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCSchemaDefinitions.h; sourceTree = "<group>"; };
151356AD0CE0CF2F0017E523 /* com.apple.SCHelper-embedded.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "com.apple.SCHelper-embedded.plist"; path = "helper/com.apple.SCHelper-embedded.plist"; sourceTree = "<group>"; };
+ 1513C3551F1849B50022398F /* update-sanitizer-dylib-references */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = text; path = "update-sanitizer-dylib-references"; sourceTree = SOURCE_ROOT; tabWidth = 8; };
1514D76D05C08A5F00757DC9 /* config_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config_types.h; path = SystemConfiguration.fproj/config_types.h; sourceTree = SOURCE_ROOT; };
151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SCPreferencesPathKey.h; path = SystemConfiguration.fproj/SCPreferencesPathKey.h; sourceTree = SOURCE_ROOT; };
151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCPreferencesPathKey.c; path = SystemConfiguration.fproj/SCPreferencesPathKey.c; sourceTree = SOURCE_ROOT; };
+ 151D060B1EC1491600E02E48 /* liblog_SystemConfiguration.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = liblog_SystemConfiguration.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 151D060D1EC14C6700E02E48 /* liblog_SystemConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = liblog_SystemConfiguration.m; path = logging/liblog_SystemConfiguration.m; sourceTree = SOURCE_ROOT; };
151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SCMonitor.plugin; sourceTree = BUILT_PRODUCTS_DIR; };
151F63EC09328A3C0096DCC9 /* genSCPreferences */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = genSCPreferences; sourceTree = BUILT_PRODUCTS_DIR; };
1520A3DE0846B2DC0010B584 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
152439E418038E5B00D91708 /* ev_extra.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ev_extra.m; sourceTree = "<group>"; };
152439E7180399D800D91708 /* CoreWLAN.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreWLAN.framework; path = /System/Library/Frameworks/CoreWLAN.framework; sourceTree = "<absolute>"; };
152439EB180716ED00D91708 /* MobileWiFi.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileWiFi.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.Internal.sdk/System/Library/PrivateFrameworks/MobileWiFi.framework; sourceTree = DEVELOPER_DIR; };
+ 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = network_state_information_logging.h; path = nwi/network_state_information_logging.h; sourceTree = "<group>"; };
+ 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = dnsinfo_logging.h; path = dnsinfo/dnsinfo_logging.h; 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>"; };
+ 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCNetworkReachabilityLogging.h; sourceTree = "<group>"; };
1532629006281C9D00B1C10C /* dnsinfo_create.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo_create.h; path = dnsinfo/dnsinfo_create.h; sourceTree = "<group>"; };
153338BA14BE7978004FCE22 /* libSystemConfiguration_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = libSystemConfiguration_client.c; path = libSystemConfiguration/libSystemConfiguration_client.c; sourceTree = "<group>"; };
153338BB14BE7978004FCE22 /* libSystemConfiguration_client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libSystemConfiguration_client.h; path = libSystemConfiguration/libSystemConfiguration_client.h; sourceTree = "<group>"; };
157A852E0D56C91100B6F1A0 /* libLinkConfiguration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLinkConfiguration.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>"; };
+ 15812A2D1EA5540B001CF384 /* nat64-configuration.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "nat64-configuration.c"; sourceTree = "<group>"; };
+ 15812A2E1EA5540B001CF384 /* nat64-configuration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "nat64-configuration.h"; sourceTree = "<group>"; };
15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KernelEventMonitor.bundle; 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>"; };
15DC346E0711D49400A3311C /* net_set.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = net_set.h; sourceTree = "<group>"; };
15E1B05916EBAE3C00E5F06F /* libIPMonitor_sim.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIPMonitor_sim.a; sourceTree = BUILT_PRODUCTS_DIR; };
15E1B06116EBAE7800E5F06F /* IPMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IPMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+ 15F742E41EC6370000DA2E7A /* liblog_SystemConfiguration.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = liblog_SystemConfiguration.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 15F742F11EC638D100DA2E7A /* liblog_SystemConfiguration.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = liblog_SystemConfiguration.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
15FB1F881E27E9A000B4F809 /* InterfaceNamerControlPrefs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = InterfaceNamerControlPrefs.c; sourceTree = "<group>"; };
15FB1F891E27E9A000B4F809 /* InterfaceNamerControlPrefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterfaceNamerControlPrefs.h; sourceTree = "<group>"; };
15FBB54B17D6834C0035D752 /* libCrashReporterClient.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libCrashReporterClient.a; path = /usr/local/lib/libCrashReporterClient.a; sourceTree = "<absolute>"; };
72573D431D6B9E72004975AD /* sctest-entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "sctest-entitlements.plist"; path = "sctest/sctest-entitlements.plist"; sourceTree = SOURCE_ROOT; };
725CB7541BF439C6000C05A8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
725CB7571BF51476000C05A8 /* configAgentDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = configAgentDefines.h; sourceTree = "<group>"; };
- 725E53D51A92D2A5009997E1 /* com.apple.networking.IPMonitor */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.networking.IPMonitor; sourceTree = "<group>"; };
726DB2F11BEA80E5001B2C6C /* config_agent_info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = config_agent_info.c; path = "config-agent-info/config_agent_info.c"; sourceTree = "<group>"; };
726DB2F21BEA80E5001B2C6C /* config_agent_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config_agent_info.h; path = "config-agent-info/config_agent_info.h"; sourceTree = "<group>"; };
7271EA321D76600B0055B1AA /* sctest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = sctest; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
+ 151D06061EC1491600E02E48 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1505A8D81EC3E1470089FC6A /* Foundation.framework in Frameworks */,
+ 154FD13B1EC4062C00EDA8B9 /* SystemConfiguration.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
151F5D980CCE98E50093AC3B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 15F742DE1EC6370000DA2E7A /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15F742DF1EC6370000DA2E7A /* Foundation.framework in Frameworks */,
+ 15F742E01EC6370000DA2E7A /* SystemConfiguration.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 15F742EB1EC638D100DA2E7A /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15F742EC1EC638D100DA2E7A /* Foundation.framework in Frameworks */,
+ 15F742ED1EC638D100DA2E7A /* SystemConfiguration.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
72573D231D667372004975AD /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 1513C3541F1849920022398F /* Build Support */ = {
+ isa = PBXGroup;
+ children = (
+ 1513C3551F1849B50022398F /* update-sanitizer-dylib-references */,
+ );
+ name = "Build Support";
+ sourceTree = "<group>";
+ };
+ 151D060C1EC14C3900E02E48 /* Logging */ = {
+ isa = PBXGroup;
+ children = (
+ 151D060D1EC14C6700E02E48 /* liblog_SystemConfiguration.m */,
+ );
+ name = Logging;
+ sourceTree = "<group>";
+ };
151F5DA80CCE995D0093AC3B /* SCMonitor */ = {
isa = PBXGroup;
children = (
15B73F0905FD1B670096477F /* dnsinfo.h */,
1532629006281C9D00B1C10C /* dnsinfo_create.h */,
159C9A8D17399609003DDA1D /* dnsinfo_internal.h */,
+ 1528922D1EDE41ED00FCFE71 /* dnsinfo_logging.h */,
15B73F0C05FD1B670096477F /* dnsinfo_private.h */,
15B73F0E05FD1B670096477F /* dnsinfo_server.h */,
);
isa = PBXGroup;
children = (
728015741BE1681B009F4F60 /* AgentMonitor */,
- 725E53D41A92D289009997E1 /* Simulator */,
D6AEB89815AE4446009F2FAF /* ip_plugin.h */,
159D53A707528B36004F8947 /* ip_plugin.c */,
155D22380AF13A7300D52ED0 /* dns-configuration.h */,
159D53AA07528B36004F8947 /* dns-configuration.c */,
- 1575FD2512CD15C60003D86E /* proxy-configuration.c */,
+ 15812A2E1EA5540B001CF384 /* nat64-configuration.h */,
+ 15812A2D1EA5540B001CF384 /* nat64-configuration.c */,
1575FD2612CD15C60003D86E /* proxy-configuration.h */,
+ 1575FD2512CD15C60003D86E /* proxy-configuration.c */,
155D22390AF13A7300D52ED0 /* set-hostname.h */,
159D53AB07528B36004F8947 /* set-hostname.c */,
155D223A0AF13A7300D52ED0 /* smb-configuration.h */,
children = (
15CB693705C0722B0099E85F /* SCNetworkReachability.h */,
15C330D0134B95AA0028E36B /* SCNetworkReachabilityInternal.h */,
+ 152EC34B1EE1B10200A1D27B /* SCNetworkReachabilityLogging.h */,
);
name = Headers;
sourceTree = "<group>";
15CB68FC05C072220099E85F /* configd */ = {
isa = PBXGroup;
children = (
+ 1513C3541F1849920022398F /* Build Support */,
15CB6A8605C072500099E85F /* MiG */,
15CB6A8305C072410099E85F /* Schema */,
15B534AD14BE778800EA6522 /* libsystem_configuration */,
+ 151D060C1EC14C3900E02E48 /* Logging */,
15CB690705C0722A0099E85F /* SystemConfiguration */,
151F5DA80CCE995D0093AC3B /* SCMonitor */,
15CB69C205C0722B0099E85F /* configd */,
155F49A21C864F5400E47D08 /* QoSMarking.bundle */,
72573D261D667372004975AD /* sctest */,
7271EA321D76600B0055B1AA /* sctest */,
+ 151D060B1EC1491600E02E48 /* liblog_SystemConfiguration.dylib */,
+ 15F742E41EC6370000DA2E7A /* liblog_SystemConfiguration.dylib */,
+ 15F742F11EC638D100DA2E7A /* liblog_SystemConfiguration.dylib */,
);
name = Products;
sourceTree = "<group>";
path = sctest;
sourceTree = "<group>";
};
- 725E53D41A92D289009997E1 /* Simulator */ = {
- isa = PBXGroup;
- children = (
- 725E53D51A92D2A5009997E1 /* com.apple.networking.IPMonitor */,
- );
- path = Simulator;
- sourceTree = "<group>";
- };
726DB2F01BEA8075001B2C6C /* ConfigAgentInformation */ = {
isa = PBXGroup;
children = (
isa = PBXGroup;
children = (
D6986A781368913C0091C931 /* network_information.h */,
+ 1528922C1EDE41ED00FCFE71 /* network_state_information_logging.h */,
D6986A761368911E0091C931 /* network_state_information_priv.h */,
720985431C580D9F00966D30 /* network_config_agent_info_priv.h */,
153ACCA714E322D5005029A5 /* network_information_server.h */,
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
+ 151D05FB1EC1491600E02E48 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15CB8F7A1EE4DD3E00726685 /* dnsinfo_logging.h in Headers */,
+ 15CB8F721EE4DD0400726685 /* network_state_information_logging.h in Headers */,
+ 15CB8F841EE4DE2600726685 /* SCNetworkReachabilityLogging.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
1547001908455B98006787CE /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- 155847470754FDCD0046C2E9 /* scutil.h in Headers */,
+ 1558474B0754FDCD0046C2E9 /* cache.h in Headers */,
155847480754FDCD0046C2E9 /* commands.h in Headers */,
155847490754FDCD0046C2E9 /* dictionary.h in Headers */,
- 1558474A0754FDCD0046C2E9 /* session.h in Headers */,
- 1558474B0754FDCD0046C2E9 /* cache.h in Headers */,
- 1558474C0754FDCD0046C2E9 /* notifications.h in Headers */,
- 1558474D0754FDCD0046C2E9 /* tests.h in Headers */,
- 1558474E0754FDCD0046C2E9 /* prefs.h in Headers */,
+ 15CB8F7B1EE4DD3F00726685 /* dnsinfo_logging.h in Headers */,
+ 72B43728113C7BFC00EBF1B6 /* nc.h in Headers */,
1558474F0754FDCD0046C2E9 /* net.h in Headers */,
+ 15CB8F711EE4DCFF00726685 /* network_state_information_logging.h in Headers */,
155847500754FDCD0046C2E9 /* net_interface.h in Headers */,
155847510754FDCD0046C2E9 /* net_protocol.h in Headers */,
155847520754FDCD0046C2E9 /* net_service.h in Headers */,
155847530754FDCD0046C2E9 /* net_set.h in Headers */,
- 72B43728113C7BFC00EBF1B6 /* nc.h in Headers */,
+ 1558474C0754FDCD0046C2E9 /* notifications.h in Headers */,
+ 1558474E0754FDCD0046C2E9 /* prefs.h in Headers */,
+ 155847470754FDCD0046C2E9 /* scutil.h in Headers */,
+ 1558474A0754FDCD0046C2E9 /* session.h in Headers */,
+ 1558474D0754FDCD0046C2E9 /* tests.h in Headers */,
1581BCD31E28679A00F69B1E /* InterfaceNamerControlPrefs.h in Headers */,
1581BCD51E2867A500F69B1E /* IPMonitorControlPrefs.h in Headers */,
+ 153E16A81EE500E70027698E /* SCNetworkReachabilityInternal.h in Headers */,
+ 15CB8F831EE4DE2200726685 /* SCNetworkReachabilityLogging.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- 15732AAF16EA511900F3AC4C /* scutil.h in Headers */,
+ 15732AB316EA511900F3AC4C /* cache.h in Headers */,
15732AB016EA511900F3AC4C /* commands.h in Headers */,
15732AB116EA511900F3AC4C /* dictionary.h in Headers */,
- 15732AB216EA511900F3AC4C /* session.h in Headers */,
- 15732AB316EA511900F3AC4C /* cache.h in Headers */,
- 15732AB416EA511900F3AC4C /* notifications.h in Headers */,
- 15732AB516EA511900F3AC4C /* tests.h in Headers */,
- 15732AB616EA511900F3AC4C /* prefs.h in Headers */,
+ 15CB8F811EE4DD4E00726685 /* dnsinfo_logging.h in Headers */,
+ 15732ABC16EA511900F3AC4C /* nc.h in Headers */,
15732AB716EA511900F3AC4C /* net.h in Headers */,
+ 15CB8F771EE4DD1900726685 /* network_state_information_logging.h in Headers */,
15732AB816EA511900F3AC4C /* net_interface.h in Headers */,
15732AB916EA511900F3AC4C /* net_protocol.h in Headers */,
15732ABA16EA511900F3AC4C /* net_service.h in Headers */,
15732ABB16EA511900F3AC4C /* net_set.h in Headers */,
- 15732ABC16EA511900F3AC4C /* nc.h in Headers */,
+ 15732AB416EA511900F3AC4C /* notifications.h in Headers */,
+ 15732AB616EA511900F3AC4C /* prefs.h in Headers */,
+ 15732AAF16EA511900F3AC4C /* scutil.h in Headers */,
+ 15732AB216EA511900F3AC4C /* session.h in Headers */,
+ 15732AB516EA511900F3AC4C /* tests.h in Headers */,
1581BCD91E2867C100F69B1E /* IPMonitorControlPrefs.h in Headers */,
+ 153E16AA1EE500EF0027698E /* SCNetworkReachabilityInternal.h in Headers */,
+ 15CB8F8A1EE4DE3B00726685 /* SCNetworkReachabilityLogging.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- 157433F20D4A8137002ACA73 /* scutil.h in Headers */,
+ 157433F60D4A8137002ACA73 /* cache.h in Headers */,
157433F30D4A8137002ACA73 /* commands.h in Headers */,
157433F40D4A8137002ACA73 /* dictionary.h in Headers */,
- 157433F50D4A8137002ACA73 /* session.h in Headers */,
- 157433F60D4A8137002ACA73 /* cache.h in Headers */,
- 157433F70D4A8137002ACA73 /* notifications.h in Headers */,
- 157433F80D4A8137002ACA73 /* tests.h in Headers */,
- 157433F90D4A8137002ACA73 /* prefs.h in Headers */,
+ 15CB8F7E1EE4DD4800726685 /* dnsinfo_logging.h in Headers */,
+ 72B4372A113C7BFC00EBF1B6 /* nc.h in Headers */,
157433FA0D4A8137002ACA73 /* net.h in Headers */,
+ 15CB8F751EE4DD1100726685 /* network_state_information_logging.h in Headers */,
157433FB0D4A8137002ACA73 /* net_interface.h in Headers */,
157433FC0D4A8137002ACA73 /* net_protocol.h in Headers */,
157433FD0D4A8137002ACA73 /* net_service.h in Headers */,
157433FE0D4A8137002ACA73 /* net_set.h in Headers */,
- 72B4372A113C7BFC00EBF1B6 /* nc.h in Headers */,
+ 157433F70D4A8137002ACA73 /* notifications.h in Headers */,
+ 157433F90D4A8137002ACA73 /* prefs.h in Headers */,
+ 157433F20D4A8137002ACA73 /* scutil.h in Headers */,
+ 157433F50D4A8137002ACA73 /* session.h in Headers */,
+ 157433F80D4A8137002ACA73 /* tests.h in Headers */,
1581BCDD1E286E0000F69B1E /* InterfaceNamerControlPrefs.h in Headers */,
1581BCD71E2867B200F69B1E /* IPMonitorControlPrefs.h in Headers */,
+ 153E16A91EE500ED0027698E /* SCNetworkReachabilityInternal.h in Headers */,
+ 15CB8F861EE4DE2E00726685 /* SCNetworkReachabilityLogging.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- F9B7AE6C186211DE00C78D18 /* IPMonitorControlServer.h in Headers */,
- 157A84F60D56C7E800B6F1A0 /* dns-configuration.h in Headers */,
+ 720985471C5835DB00966D30 /* agent-monitor.h in Headers */,
720A4C0B1C585C93007436B8 /* controller.h in Headers */,
- 15D48EC20F67061F00B4711E /* dnsinfo_create.h in Headers */,
+ 720A4C0A1C585C7D007436B8 /* configAgent.h in Headers */,
+ 725CB7591BF514F5000C05A8 /* configAgentDefines.h in Headers */,
720A4C0C1C585C97007436B8 /* dnsAgent.h in Headers */,
+ 15D48EC20F67061F00B4711E /* dnsinfo_create.h in Headers */,
+ 15CB8F7C1EE4DD4300726685 /* dnsinfo_logging.h in Headers */,
+ 157A84F60D56C7E800B6F1A0 /* dns-configuration.h in Headers */,
+ 1596A7B514EDB73D00798C39 /* libSystemConfiguration_server.h in Headers */,
720985451C580D9F00966D30 /* network_config_agent_info_priv.h in Headers */,
+ 153ACCAC14E322D5005029A5 /* network_information_server.h in Headers */,
+ 15CB8F731EE4DD0B00726685 /* network_state_information_logging.h in Headers */,
E4F211D4137B0ABD00BBB915 /* network_state_information_priv.h in Headers */,
720A4C0D1C585C9F007436B8 /* proxyAgent.h in Headers */,
1575FD2812CD15C60003D86E /* proxy-configuration.h in Headers */,
- F9B7AE6F186211F600C78D18 /* symbol_scope.h in Headers */,
- F9B7AE68186211C900C78D18 /* IPMonitorControlPrivate.h in Headers */,
- 725CB7591BF514F5000C05A8 /* configAgentDefines.h in Headers */,
- 720985471C5835DB00966D30 /* agent-monitor.h in Headers */,
157A84F70D56C7E800B6F1A0 /* set-hostname.h in Headers */,
- 153ACCAC14E322D5005029A5 /* network_information_server.h in Headers */,
- 720A4C0A1C585C7D007436B8 /* configAgent.h in Headers */,
- 1596A7B514EDB73D00798C39 /* libSystemConfiguration_server.h in Headers */,
+ F9B7AE6F186211F600C78D18 /* symbol_scope.h in Headers */,
1581BCD61E2867AF00F69B1E /* IPMonitorControlPrefs.h in Headers */,
+ F9B7AE68186211C900C78D18 /* IPMonitorControlPrivate.h in Headers */,
+ F9B7AE6C186211DE00C78D18 /* IPMonitorControlServer.h in Headers */,
+ 153E16A61EE5008A0027698E /* SCNetworkReachabilityInternal.h in Headers */,
+ 15CB8F851EE4DE2B00726685 /* SCNetworkReachabilityLogging.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
buildActionMask = 2147483647;
files = (
728015991BE1812B009F4F60 /* agent-monitor.h in Headers */,
- 7280159B1BE1812B009F4F60 /* configAgent.h in Headers */,
7280159C1BE1812B009F4F60 /* controller.h in Headers */,
+ 7280159B1BE1812B009F4F60 /* configAgent.h in Headers */,
+ 725CB7581BF514F2000C05A8 /* configAgentDefines.h in Headers */,
+ 15D48EC00F67061700B4711E /* dnsinfo_create.h in Headers */,
+ 15CB8F791EE4DD3B00726685 /* dnsinfo_logging.h in Headers */,
7280159D1BE1812B009F4F60 /* dnsAgent.h in Headers */,
- 7280159E1BE1812B009F4F60 /* proxyAgent.h in Headers */,
155D223B0AF13A7300D52ED0 /* dns-configuration.h in Headers */,
- 1581BCD41E2867A300F69B1E /* IPMonitorControlPrefs.h in Headers */,
- 15D48EC00F67061700B4711E /* dnsinfo_create.h in Headers */,
- 725CB7581BF514F2000C05A8 /* configAgentDefines.h in Headers */,
- E4F211D7137B0AF200BBB915 /* network_state_information_priv.h in Headers */,
+ 1596A7B414EDB73D00798C39 /* libSystemConfiguration_server.h in Headers */,
720985441C580D9F00966D30 /* network_config_agent_info_priv.h in Headers */,
+ 153ACCAB14E322D5005029A5 /* network_information_server.h in Headers */,
+ 15CB8F701EE4DCFC00726685 /* network_state_information_logging.h in Headers */,
+ E4F211D7137B0AF200BBB915 /* network_state_information_priv.h in Headers */,
+ 7280159E1BE1812B009F4F60 /* proxyAgent.h in Headers */,
1575FD2A12CD15C60003D86E /* proxy-configuration.h in Headers */,
155D223C0AF13A7300D52ED0 /* set-hostname.h in Headers */,
- F9B7AE67186211C200C78D18 /* IPMonitorControlPrivate.h in Headers */,
- F9B7AE6E186211F000C78D18 /* symbol_scope.h in Headers */,
155D223D0AF13A7300D52ED0 /* smb-configuration.h in Headers */,
+ F9B7AE6E186211F000C78D18 /* symbol_scope.h in Headers */,
+ 1581BCD41E2867A300F69B1E /* IPMonitorControlPrefs.h in Headers */,
+ F9B7AE67186211C200C78D18 /* IPMonitorControlPrivate.h in Headers */,
F9B7AE6B186211DA00C78D18 /* IPMonitorControlServer.h in Headers */,
- 153ACCAB14E322D5005029A5 /* network_information_server.h in Headers */,
- 1596A7B414EDB73D00798C39 /* libSystemConfiguration_server.h in Headers */,
+ 153E16A51EE500810027698E /* SCNetworkReachabilityInternal.h in Headers */,
+ 15CB8F821EE4DE1F00726685 /* SCNetworkReachabilityLogging.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- 15E1B04316EBAE3C00E5F06F /* dns-configuration.h in Headers */,
15E1B04416EBAE3C00E5F06F /* dnsinfo_create.h in Headers */,
+ 15CB8F7F1EE4DD4B00726685 /* dnsinfo_logging.h in Headers */,
+ 15E1B04316EBAE3C00E5F06F /* dns-configuration.h in Headers */,
+ 15E1B04916EBAE3C00E5F06F /* libSystemConfiguration_server.h in Headers */,
+ 15E1B04816EBAE3C00E5F06F /* network_information_server.h in Headers */,
+ 15CB8F761EE4DD1600726685 /* network_state_information_logging.h in Headers */,
15E1B04516EBAE3C00E5F06F /* network_state_information_priv.h in Headers */,
15E1B04616EBAE3C00E5F06F /* proxy-configuration.h in Headers */,
- 15E1B04816EBAE3C00E5F06F /* network_information_server.h in Headers */,
1581BCD81E2867BA00F69B1E /* IPMonitorControlPrefs.h in Headers */,
- 15E1B04916EBAE3C00E5F06F /* libSystemConfiguration_server.h in Headers */,
+ 153E16A71EE5008F0027698E /* SCNetworkReachabilityInternal.h in Headers */,
+ 15CB8F881EE4DE3300726685 /* SCNetworkReachabilityLogging.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 15F742DB1EC6370000DA2E7A /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15CB8F7D1EE4DD4600726685 /* dnsinfo_logging.h in Headers */,
+ 15CB8F741EE4DD1000726685 /* network_state_information_logging.h in Headers */,
+ 15CB8F871EE4DE3000726685 /* SCNetworkReachabilityLogging.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 15F742E81EC638D100DA2E7A /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15CB8F801EE4DD4D00726685 /* dnsinfo_logging.h in Headers */,
+ 15CB8F781EE4DD1B00726685 /* network_state_information_logging.h in Headers */,
+ 15CB8F891EE4DE3600726685 /* SCNetworkReachabilityLogging.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
+ 151D05FA1EC1491600E02E48 /* liblog_SystemConfiguration */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 151D06081EC1491600E02E48 /* Build configuration list for PBXNativeTarget "liblog_SystemConfiguration" */;
+ buildPhases = (
+ 151D05FB1EC1491600E02E48 /* Headers */,
+ 151D06011EC1491600E02E48 /* Sources */,
+ 151D06061EC1491600E02E48 /* Frameworks */,
+ 1513C35A1F186A700022398F /* Update "install_path" for address|thread sanitizers */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = liblog_SystemConfiguration;
+ productInstallPath = /usr/local/lib/system;
+ productName = DNSConfiguration;
+ productReference = 151D060B1EC1491600E02E48 /* liblog_SystemConfiguration.dylib */;
+ productType = "com.apple.product-type.library.dynamic";
+ };
151F5D990CCE98E50093AC3B /* SCMonitor */ = {
isa = PBXNativeTarget;
buildConfigurationList = 151F5D9F0CCE98E60093AC3B /* Build configuration list for PBXNativeTarget "SCMonitor" */;
151F5D960CCE98E50093AC3B /* Resources */,
151F5D970CCE98E50093AC3B /* Sources */,
151F5D980CCE98E50093AC3B /* Frameworks */,
+ 1513C3591F18697C0022398F /* Update "install_path" for address|thread sanitizers */,
);
buildRules = (
);
1547001908455B98006787CE /* Headers */,
1547001A08455B98006787CE /* Sources */,
1547001B08455B98006787CE /* Frameworks */,
+ 15A66BB21F1817AC00F7253B /* Update "install_path" for address|thread sanitizers */,
15FF5C380CDF778F00EEC8AA /* CopyFiles */,
);
buildRules = (
155847460754FDCD0046C2E9 /* Headers */,
155847540754FDCD0046C2E9 /* Sources */,
155847620754FDCD0046C2E9 /* Frameworks */,
+ 1513C3581F1869630022398F /* Update "install_path" for address|thread sanitizers */,
155847680754FDCD0046C2E9 /* CopyFiles */,
);
buildRules = (
1558481407550EC10046C2E9 /* Headers */,
1558481507550EC10046C2E9 /* Sources */,
1558481707550EC10046C2E9 /* Frameworks */,
+ 1513C3571F1869530022398F /* Update "install_path" for address|thread sanitizers */,
1558481B07550EC10046C2E9 /* CopyFiles */,
);
buildRules = (
153393E40D34999D00FE74E7 /* Update Headers */,
1572C4DE0CFB55B400E2776E /* Sources */,
1572C5230CFB55B400E2776E /* Frameworks */,
+ 1513C35C1F186BF90022398F /* Update "install_path" for address|thread sanitizers */,
1572C4D90CFB55B400E2776E /* Resources */,
1510A7301B17E1AF00125A85 /* Add framework symlink (TEMPORARY) */,
1572C5270CFB55B400E2776E /* get-mobility-info */,
157433DE0D4A8122002ACA73 /* Headers */,
157433DF0D4A8122002ACA73 /* Sources */,
157433E10D4A8122002ACA73 /* Frameworks */,
+ 1513C3601F186C460022398F /* Update "install_path" for address|thread sanitizers */,
);
buildRules = (
);
157433F10D4A8137002ACA73 /* Headers */,
157433FF0D4A8137002ACA73 /* Sources */,
1574340D0D4A8137002ACA73 /* Frameworks */,
+ 1513C3611F186C4D0022398F /* Update "install_path" for address|thread sanitizers */,
);
buildRules = (
);
157A84D90D56C63900B6F1A0 /* Headers */,
157A84DD0D56C63900B6F1A0 /* Sources */,
157A84E20D56C63900B6F1A0 /* Frameworks */,
- 154070A11B98E8D3003195EF /* Update "install_path" for address sanitizer */,
+ 154070A11B98E8D3003195EF /* Update "install_path" for address|thread sanitizers */,
);
buildRules = (
);
158317240CFB80A1006F62B9 /* Headers */,
1583172C0CFB80A1006F62B9 /* Sources */,
1583174B0CFB80A1006F62B9 /* Frameworks */,
+ 1513C35F1F186C3A0022398F /* Update "install_path" for address|thread sanitizers */,
1583175B0CFB80A1006F62B9 /* CopyFiles */,
15FBB55117D78B670035D752 /* Update MachServices */,
);
1583379A0CFB6B9E0033AB93 /* Headers */,
1583379D0CFB6B9E0033AB93 /* Sources */,
1583379F0CFB6B9E0033AB93 /* Frameworks */,
+ 1513C35D1F186C0B0022398F /* Update "install_path" for address|thread sanitizers */,
158337A40CFB6B9E0033AB93 /* CopyFiles */,
1595B4B81B0C02FA0087944E /* Update SCHelper launchd .plist */,
);
159D54A307529FFF004F8947 /* Headers */,
159D54AB07529FFF004F8947 /* Sources */,
159D54CA07529FFF004F8947 /* Frameworks */,
+ 1513C3561F1857E00022398F /* Update "install_path" for address|thread sanitizers */,
159D54D507529FFF004F8947 /* CopyFiles */,
159D54D707529FFF004F8947 /* Copy Files */,
15FBB54D17D75DE70035D752 /* Update MachServices */,
15DAD5E0075913CE0084A6ED /* Headers */,
15DAD5E4075913CE0084A6ED /* Sources */,
15DAD5E9075913CE0084A6ED /* Frameworks */,
- 154070A01B968548003195EF /* Update "install_path" for address sanitizer */,
+ 154070A01B968548003195EF /* Update "install_path" for address|thread sanitizers */,
);
buildRules = (
);
15AC82480D376E2400A579D0 /* Update Headers */,
15DAD66C07591A1A0084A6ED /* Sources */,
15DAD6AD07591A1A0084A6ED /* Frameworks */,
+ 15A66BB11F18177100F7253B /* Update "install_path" for address|thread sanitizers */,
15DAD66807591A1A0084A6ED /* Resources */,
15DAD6B007591A1A0084A6ED /* get-mobility-info */,
15D9DCF910DD909F004E545D /* AppWorkaround.plist */,
productReference = 15E1B06116EBAE7800E5F06F /* IPMonitor.bundle */;
productType = "com.apple.product-type.bundle";
};
+ 15F742DA1EC6370000DA2E7A /* liblog_SystemConfiguration-Embedded */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 15F742E11EC6370000DA2E7A /* Build configuration list for PBXNativeTarget "liblog_SystemConfiguration-Embedded" */;
+ buildPhases = (
+ 15F742DB1EC6370000DA2E7A /* Headers */,
+ 15F742DC1EC6370000DA2E7A /* Sources */,
+ 15F742DE1EC6370000DA2E7A /* Frameworks */,
+ 1513C35E1F186C310022398F /* Update "install_path" for address|thread sanitizers */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "liblog_SystemConfiguration-Embedded";
+ productInstallPath = /usr/local/lib/system;
+ productName = DNSConfiguration;
+ productReference = 15F742E41EC6370000DA2E7A /* liblog_SystemConfiguration.dylib */;
+ productType = "com.apple.product-type.library.dynamic";
+ };
+ 15F742E71EC638D100DA2E7A /* liblog_SystemConfiguration-EmbeddedSimulator */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 15F742EE1EC638D100DA2E7A /* Build configuration list for PBXNativeTarget "liblog_SystemConfiguration-EmbeddedSimulator" */;
+ buildPhases = (
+ 15F742E81EC638D100DA2E7A /* Headers */,
+ 15F742E91EC638D100DA2E7A /* Sources */,
+ 15F742EB1EC638D100DA2E7A /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "liblog_SystemConfiguration-EmbeddedSimulator";
+ productInstallPath = /usr/local/lib/system;
+ productName = DNSConfiguration;
+ productReference = 15F742F11EC638D100DA2E7A /* liblog_SystemConfiguration.dylib */;
+ productType = "com.apple.product-type.library.dynamic";
+ };
15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */ = {
isa = PBXNativeTarget;
buildConfigurationList = 156EB5FA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle" */;
buildPhases = (
72573D221D667372004975AD /* Sources */,
72573D231D667372004975AD /* Frameworks */,
+ 1513C35B1F186AE20022398F /* Update "install_path" for address|thread sanitizers */,
72573D241D667372004975AD /* npt_configd.plist */,
- 72C12CB21D6FEFBE000EE61C /* ShellScript */,
+ 72C12CB21D6FEFBE000EE61C /* Fix plist ownership */,
);
buildRules = (
);
buildPhases = (
7271EA1D1D76600B0055B1AA /* Sources */,
7271EA271D76600B0055B1AA /* Frameworks */,
+ 1513C3621F186C560022398F /* Update "install_path" for address|thread sanitizers */,
7271EA2C1D76600B0055B1AA /* npt_configd.plist */,
7271EA2E1D76600B0055B1AA /* Fix plist ownership */,
);
15CB6A7705C0722B0099E85F /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0800;
+ LastUpgradeCheck = 0900;
TargetAttributes = {
72573D251D667372004975AD = {
CreatedOnToolsVersion = 8.0;
155F49861C864F1400E47D08 /* QoSMarking */,
155F498E1C864F3700E47D08 /* QoSMarking.bundle */,
155847FA07550D210046C2E9 /* configd_executables */,
+ 151D05FA1EC1491600E02E48 /* liblog_SystemConfiguration */,
159D549F07529FFF004F8947 /* configd */,
1558481207550EC10046C2E9 /* scselect */,
155847430754FDCD0046C2E9 /* scutil */,
+ 72573D251D667372004975AD /* sctest */,
151F5D990CCE98E50093AC3B /* SCMonitor */,
151C1CC60CFB487000C5AFD6 /* All-Embedded */,
15C64A280F684C6B00D78394 /* configd_libSystem-Embedded */,
155F49951C864F4E00E47D08 /* QoSMarking-Embedded */,
155F499D1C864F5400E47D08 /* QoSMarking.bundle-Embedded */,
158317040CFB7782006F62B9 /* configd_executables-Embedded */,
+ 15F742DA1EC6370000DA2E7A /* liblog_SystemConfiguration-Embedded */,
158317230CFB80A1006F62B9 /* configd-Embedded */,
157433DD0D4A8122002ACA73 /* scselect-Embedded */,
157433F00D4A8137002ACA73 /* scutil-Embedded */,
+ 7271EA1B1D76600B0055B1AA /* sctest-Embedded */,
15FD13BF0D59485000F9409C /* All-EmbeddedSimulator */,
157FDE3B164A075F0040D6A8 /* configd_libSystem-EmbeddedSimulator */,
15732AD616EA6B6700F3AC4C /* libsystem_configuration-EmbeddedSimulator */,
15E1B05A16EBAE7800E5F06F /* IPMonitor.bundle-EmbeddedSimulator */,
15D3080F16F3E4DA00014F82 /* SimulatorSupport-EmbeddedSimulator */,
15D3082816F3E4E100014F82 /* SimulatorSupport.bundle-EmbeddedSimulator */,
+ 15631D161ECF98FB0088EEDD /* configd_executables-EmbeddedSimulator */,
+ 15F742E71EC638D100DA2E7A /* liblog_SystemConfiguration-EmbeddedSimulator */,
15732A7616EA503200F3AC4C /* configd-EmbeddedSimulator */,
15732AAD16EA511900F3AC4C /* scutil-EmbeddedSimulator */,
151F63DA09328A3C0096DCC9 /* Schema */,
15E83104167F9AF600FD51EC /* EVERYTHING */,
72D3E65D1AE6EA3900DB4C69 /* SCTest-Swift */,
72D3E6681AE6EAF600DB4C69 /* SCTest-ObjC */,
- 72573D251D667372004975AD /* sctest */,
- 7271EA1B1D76600B0055B1AA /* sctest-Embedded */,
);
};
/* End PBXProject section */
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 1502C5611BDD4936005CF7EA /* Move libsystem_configuration_asan.dylib */ = {
+ 1502C5611BDD4936005CF7EA /* Move libsystem_configuration_(asan|tsan).dylib */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 8;
files = (
);
inputPaths = (
);
- name = "Move libsystem_configuration_asan.dylib";
+ name = "Move libsystem_configuration_(asan|tsan).dylib";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
- shellScript = "#\n# move libsystem_configuration_asan.dylib out of /usr/lib/system\n#\n# Note: to use the asan .dylib, set DYLD_INSERT_LIBRARIES=...\n#\nfor VARIANT in ${BUILD_VARIANTS}\ndo\n if [ \"${VARIANT}\" = \"asan\" ]; then\n DIR_O=\"/usr/lib/system\"\n DIR_N=\"/usr/local/lib\"\n DYLIB=\"libsystem_configuration_${VARIANT}.dylib\"\n\n\t\tmkdir -p \"${DSTROOT}/${DIR_N}\"\n\t\tmv \"${DSTROOT}/${DIR_O}/${DYLIB}\" \"${DSTROOT}/${DIR_N}/${DYLIB}\"\n\t\tif [ -d \"${DSTROOT}/${DIR_O}/${DYLIB}.dSYM\" ]; then\n\t\t\tmv \"${DSTROOT}/${DIR_O}/${DYLIB}.dSYM\" \"${DSTROOT}/${DIR_N}/${DYLIB}.dSYM\"\n\t\tfi\n fi\ndone";
+ shellScript = "#\n# move libsystem_configuration_[at]san.dylib out of /usr/lib/system\n#\n# Note: to use the asan/tsan .dylib, set DYLD_INSERT_LIBRARIES=...\n#\nfor VARIANT in ${BUILD_VARIANTS}\ndo\n if [ \"${VARIANT}\" = \"asan\" -o \"${VARIANT}\" = \"tsan\" ]; then\n DIR_O=\"/usr/lib/system\"\n DIR_N=\"/usr/local/lib\"\n DYLIB=\"libsystem_configuration_${VARIANT}.dylib\"\n\n\t\tmkdir -p \"${DSTROOT}/${DIR_N}\"\n\t\tmv \"${DSTROOT}/${DIR_O}/${DYLIB}\" \"${DSTROOT}/${DIR_N}/${DYLIB}\"\n\t\tif [ -d \"${DSTROOT}/${DIR_O}/${DYLIB}.dSYM\" ]; then\n\t\t\tmv \"${DSTROOT}/${DIR_O}/${DYLIB}.dSYM\" \"${DSTROOT}/${DIR_N}/${DYLIB}.dSYM\"\n\t\tfi\n fi\ndone";
showEnvVarsInLog = 0;
};
1510A7301B17E1AF00125A85 /* Add framework symlink (TEMPORARY) */ = {
shellScript = "if [ \"${USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK}\" = \"YES\" ]; then\n mkdir -p ${DSTROOT}/System/Library/Frameworks\n cd ${DSTROOT}/System/Library/Frameworks\n rm -rf SystemConfiguration.framework\n ln -s ../PrivateFrameworks/SystemConfiguration.framework .\nfi";
showEnvVarsInLog = 0;
};
- 151F63DB09328A3C0096DCC9 /* ShellScript */ = {
+ 1513C3561F1857E00022398F /* Update "install_path" for address|thread sanitizers */ = {
isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
+ buildActionMask = 12;
files = (
);
inputPaths = (
- SystemConfiguration.fproj/genSCPreferences.c,
);
+ name = "Update \"install_path\" for address|thread sanitizers";
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";
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
};
- 153393E40D34999D00FE74E7 /* Update Headers */ = {
+ 1513C3571F1869530022398F /* Update "install_path" for address|thread sanitizers */ = {
isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
+ buildActionMask = 12;
files = (
);
inputPaths = (
- "$(SRCROOT)/SystemConfiguration.fproj/update-headers",
);
- name = "Update Headers";
+ name = "Update \"install_path\" for address|thread sanitizers";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} split\nfi";
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
showEnvVarsInLog = 0;
};
- 1535FEDC1B0FDDCD00B2A3AD /* Add framework symlink (TEMPORARY) */ = {
+ 1513C3581F1869630022398F /* Update "install_path" for address|thread sanitizers */ = {
isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
+ buildActionMask = 12;
files = (
);
inputPaths = (
);
- name = "Add framework symlink (TEMPORARY)";
+ name = "Update \"install_path\" for address|thread sanitizers";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "if [ \"${USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK}\" = \"YES\" ]; then\n mkdir -p ${DSTROOT}/System/Library/Frameworks\n cd ${DSTROOT}/System/Library/Frameworks\n rm -rf SystemConfiguration.framework\n ln -s ../PrivateFrameworks/SystemConfiguration.framework .\nfi";
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
showEnvVarsInLog = 0;
};
- 154070A01B968548003195EF /* Update "install_path" for address sanitizer */ = {
+ 1513C3591F18697C0022398F /* Update "install_path" for address|thread sanitizers */ = {
isa = PBXShellScriptBuildPhase;
- buildActionMask = 8;
+ buildActionMask = 12;
files = (
);
inputPaths = (
);
- name = "Update \"install_path\" for address sanitizer";
+ name = "Update \"install_path\" for address|thread sanitizers";
outputPaths = (
);
- runOnlyForDeploymentPostprocessing = 1;
+ runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "#\n# fix address-sanitizer library @rpath references\n#\n\nfor VARIANT in ${BUILD_VARIANTS}\ndo\n if [ \"${VARIANT}\" = \"asan\" ]; then\n ASAN_SDK_DIR=\"${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin\"\n ASAN_DST_DIR=\"/usr/local/lib\"\n case \"${PLATFORM_NAME}\" in\n macosx )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_osx_dynamic.dylib\"\n ;;\n iphoneos )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_ios_dynamic.dylib\"\n ;;\n iphonesimulator )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_iossim_dynamic.dylib\"\n ;;\n tvos )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_tvos_dynamic.dylib\"\n ;;\n tvsosimulator )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_tvossim_dynamic.dylib\"\n ;;\n watchos )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_watchos_dynamic.dylib\"\n ;;\n watchsimulator )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_watchossim_dynamic.dylib\"\n ;;\n esac\n\n if [ ! -f \"${ASAN_SDK_DIR}/lib${ASAN_LIB}\" ]; then exit 0; fi\n\n\t\t# ensure that the ASAN dylib will be in the DSTROOT\n ditto \"${ASAN_SDK_DIR}/lib${ASAN_LIB}\" \"${DSTROOT}${ASAN_DST_DIR}/lib${ASAN_LIB}\"\n\n\t\t# change @rpath reference\n install_name_tool \\\n -change \\\n \"@rpath/lib${ASAN_LIB}\" \\\n \"${ASAN_DST_DIR}/lib${ASAN_LIB}\" \\\n \"${DSTROOT}${INSTALL_PATH}/${PRODUCT_NAME}_asan.dylib\"\n fi\ndone";
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
showEnvVarsInLog = 0;
};
- 154070A11B98E8D3003195EF /* Update "install_path" for address sanitizer */ = {
+ 1513C35A1F186A700022398F /* Update "install_path" for address|thread sanitizers */ = {
isa = PBXShellScriptBuildPhase;
- buildActionMask = 8;
+ buildActionMask = 12;
files = (
);
inputPaths = (
);
- name = "Update \"install_path\" for address sanitizer";
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 1513C35B1F186AE20022398F /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 12;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 1513C35C1F186BF90022398F /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 1513C35D1F186C0B0022398F /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 1513C35E1F186C310022398F /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 1513C35F1F186C3A0022398F /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 1513C3601F186C460022398F /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 1513C3611F186C4D0022398F /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 1513C3621F186C560022398F /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 151F63DB09328A3C0096DCC9 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ 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";
+ };
+ 153393E40D34999D00FE74E7 /* Update Headers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(SRCROOT)/SystemConfiguration.fproj/update-headers",
+ );
+ name = "Update Headers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} split\nfi";
+ showEnvVarsInLog = 0;
+ };
+ 1535FEDC1B0FDDCD00B2A3AD /* Add framework symlink (TEMPORARY) */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Add framework symlink (TEMPORARY)";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "if [ \"${USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK}\" = \"YES\" ]; then\n mkdir -p ${DSTROOT}/System/Library/Frameworks\n cd ${DSTROOT}/System/Library/Frameworks\n rm -rf SystemConfiguration.framework\n ln -s ../PrivateFrameworks/SystemConfiguration.framework .\nfi";
+ showEnvVarsInLog = 0;
+ };
+ 154070A01B968548003195EF /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 12;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 154070A11B98E8D3003195EF /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
- shellScript = "#\n# fix address-sanitizer library @rpath references\n#\n\nfor VARIANT in ${BUILD_VARIANTS}\ndo\n if [ \"${VARIANT}\" = \"asan\" ]; then\n ASAN_SDK_DIR=\"${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin\"\n ASAN_DST_DIR=\"/usr/local/lib\"\n case \"${PLATFORM_NAME}\" in\n macosx )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_osx_dynamic.dylib\"\n ;;\n iphoneos )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_ios_dynamic.dylib\"\n ;;\n iphonesimulator )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_iossim_dynamic.dylib\"\n ;;\n tvos )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_tvos_dynamic.dylib\"\n ;;\n tvsosimulator )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_tvossim_dynamic.dylib\"\n ;;\n watchos )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_watchos_dynamic.dylib\"\n ;;\n watchsimulator )\n\t\t\t\tASAN_LIB=\"clang_rt.asan_watchossim_dynamic.dylib\"\n ;;\n esac\n\n if [ ! -f \"${ASAN_SDK_DIR}/lib${ASAN_LIB}\" ]; then exit 0; fi\n\n\t\t# ensure that the ASAN dylib will be in the DSTROOT\n ditto \"${ASAN_SDK_DIR}/lib${ASAN_LIB}\" \"${DSTROOT}${ASAN_DST_DIR}/lib${ASAN_LIB}\"\n\n\t\t# change @rpath reference\n install_name_tool \\\n -change \\\n \"@rpath/lib${ASAN_LIB}\" \\\n \"${ASAN_DST_DIR}/lib${ASAN_LIB}\" \\\n \"${DSTROOT}${INSTALL_PATH}/${PRODUCT_NAME}_asan.dylib\"\n fi\ndone";
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
showEnvVarsInLog = 0;
};
1572C5270CFB55B400E2776E /* get-mobility-info */ = {
shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} split\nfi";
showEnvVarsInLog = 0;
};
+ 15A66BB11F18177100F7253B /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 12;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
+ 15A66BB21F1817AC00F7253B /* Update "install_path" for address|thread sanitizers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 12;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Update \"install_path\" for address|thread sanitizers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "${SRCROOT}/update-sanitizer-dylib-references";
+ showEnvVarsInLog = 0;
+ };
15AC82480D376E2400A579D0 /* Update Headers */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} clean\nfi\n";
showEnvVarsInLog = 0;
};
- 15AC9A4C1BE3ED87003071BD /* Move libsystem_configuration_asan.dylib */ = {
+ 15AC9A4C1BE3ED87003071BD /* Move libsystem_configuration_(asan|tsan).dylib */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 8;
files = (
);
inputPaths = (
);
- name = "Move libsystem_configuration_asan.dylib";
+ name = "Move libsystem_configuration_(asan|tsan).dylib";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
- shellScript = "#\n# move libsystem_configuration_asan.dylib out of /usr/lib/system\n#\n# Note: to use the asan .dylib, set DYLD_INSERT_LIBRARIES=...\n#\nfor VARIANT in ${BUILD_VARIANTS}\ndo\n if [ \"${VARIANT}\" = \"asan\" ]; then\n DIR_O=\"/usr/lib/system\"\n DIR_N=\"/usr/local/lib\"\n DYLIB=\"libsystem_configuration_${VARIANT}.dylib\"\n\n\t\tmkdir -p \"${DSTROOT}/${DIR_N}\"\n\t\tmv \"${DSTROOT}/${DIR_O}/${DYLIB}\" \"${DSTROOT}/${DIR_N}/${DYLIB}\"\n\t\tif [ -d \"${DSTROOT}/${DIR_O}/${DYLIB}.dSYM\" ]; then\n\t\t\tmv \"${DSTROOT}/${DIR_O}/${DYLIB}.dSYM\" \"${DSTROOT}/${DIR_N}/${DYLIB}.dSYM\"\n\t\tfi\n fi\ndone";
+ shellScript = "#\n# move libsystem_configuration_[at]san.dylib out of /usr/lib/system\n#\n# Note: to use the asan/tsan .dylib, set DYLD_INSERT_LIBRARIES=...\n#\nfor VARIANT in ${BUILD_VARIANTS}\ndo\n if [ \"${VARIANT}\" = \"asan\" -o \"${VARIANT}\" = \"tsan\" ]; then\n DIR_O=\"/usr/lib/system\"\n DIR_N=\"/usr/local/lib\"\n DYLIB=\"libsystem_configuration_${VARIANT}.dylib\"\n\n\t\tmkdir -p \"${DSTROOT}/${DIR_N}\"\n\t\tmv \"${DSTROOT}/${DIR_O}/${DYLIB}\" \"${DSTROOT}/${DIR_N}/${DYLIB}\"\n\t\tif [ -d \"${DSTROOT}/${DIR_O}/${DYLIB}.dSYM\" ]; then\n\t\t\tmv \"${DSTROOT}/${DIR_O}/${DYLIB}.dSYM\" \"${DSTROOT}/${DIR_N}/${DYLIB}.dSYM\"\n\t\tfi\n fi\ndone";
showEnvVarsInLog = 0;
};
15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */ = {
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n ${SCRIPT_INPUT_FILE_0} com.apple.configd.plist\nfi";
+ showEnvVarsInLog = 0;
};
15FBB55117D78B670035D752 /* Update MachServices */ = {
isa = PBXShellScriptBuildPhase;
shellPath = /bin/sh;
shellScript = "if [ ${UID} -eq 0 ]; then\n\tchown 0:0 \"${DSTROOT}/AppleInternal/CoreOS/BATS/npt_tests/npt_configd.plist\"\nfi\n\nexit 0";
};
- 72C12CB21D6FEFBE000EE61C /* ShellScript */ = {
+ 72C12CB21D6FEFBE000EE61C /* Fix plist ownership */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 8;
files = (
);
inputPaths = (
);
+ name = "Fix plist ownership";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 1;
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
+ 151D06011EC1491600E02E48 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 151D060E1EC14C8600E02E48 /* liblog_SystemConfiguration.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
151F5D970CCE98E50093AC3B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
153ACCA914E322D5005029A5 /* network_information_server.c in Sources */,
1575FD2712CD15C60003D86E /* proxy-configuration.c in Sources */,
157A84FC0D56C7E800B6F1A0 /* set-hostname.c in Sources */,
+ 1501F76A1EA8019D006A71B0 /* nat64-configuration.c in Sources */,
7280158B1BE1685B009F4F60 /* controller.m in Sources */,
728015821BE16840009F4F60 /* agent-monitor.m in Sources */,
1596A7B214EDB73D00798C39 /* libSystemConfiguration_server.c in Sources */,
159D541707528E05004F8947 /* ip_plugin.c in Sources */,
7280158D1BE16861009F4F60 /* dnsAgent.m in Sources */,
E49173E1137C4E4F0000089F /* network_state_information_priv.c in Sources */,
+ 1501F7691EA80189006A71B0 /* nat64-configuration.c in Sources */,
153ACCA814E322D5005029A5 /* network_information_server.c in Sources */,
1575FD2912CD15C60003D86E /* proxy-configuration.c in Sources */,
154361E00752C81800A8EC6C /* set-hostname.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 15F742DC1EC6370000DA2E7A /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15F742DD1EC6370000DA2E7A /* liblog_SystemConfiguration.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 15F742E91EC638D100DA2E7A /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15F742EA1EC638D100DA2E7A /* liblog_SystemConfiguration.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
72573D221D667372004975AD /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
target = 151FE2DD0D5B7046000D6DB1 /* configd_base-EmbeddedSimulator */;
targetProxy = 151FE3790D5B713C000D6DB1 /* PBXContainerItemProxy */;
};
+ 1523BBE21E075859006281F1 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 158337990CFB6B9E0033AB93 /* SCHelper-Embedded */;
+ targetProxy = 1523BBE11E075859006281F1 /* PBXContainerItemProxy */;
+ };
1558480607550D470046C2E9 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 159D549F07529FFF004F8947 /* configd */;
target = 155847FA07550D210046C2E9 /* configd_executables */;
targetProxy = 1558480E07550DD00046C2E9 /* PBXContainerItemProxy */;
};
+ 155F49A91C8650E900E47D08 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 155F49861C864F1400E47D08 /* QoSMarking */;
+ targetProxy = 155F49A81C8650E900E47D08 /* PBXContainerItemProxy */;
+ };
+ 155F49AB1C8650E900E47D08 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 155F498E1C864F3700E47D08 /* QoSMarking.bundle */;
+ targetProxy = 155F49AA1C8650E900E47D08 /* PBXContainerItemProxy */;
+ };
155F49AD1C86511300E47D08 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 155F49951C864F4E00E47D08 /* QoSMarking-Embedded */;
target = 155F499D1C864F5400E47D08 /* QoSMarking.bundle-Embedded */;
targetProxy = 155F49AE1C86511300E47D08 /* PBXContainerItemProxy */;
};
+ 15631D111ECF92E70088EEDD /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 151D05FA1EC1491600E02E48 /* liblog_SystemConfiguration */;
+ targetProxy = 15631D101ECF92E70088EEDD /* PBXContainerItemProxy */;
+ };
+ 15631D131ECF93040088EEDD /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 15F742DA1EC6370000DA2E7A /* liblog_SystemConfiguration-Embedded */;
+ targetProxy = 15631D121ECF93040088EEDD /* PBXContainerItemProxy */;
+ };
+ 15631D271ECF99800088EEDD /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 15F742E71EC638D100DA2E7A /* liblog_SystemConfiguration-EmbeddedSimulator */;
+ targetProxy = 15631D261ECF99800088EEDD /* PBXContainerItemProxy */;
+ };
+ 15631D291ECF99800088EEDD /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 15732A7616EA503200F3AC4C /* configd-EmbeddedSimulator */;
+ targetProxy = 15631D281ECF99800088EEDD /* PBXContainerItemProxy */;
+ };
+ 15631D2B1ECF99800088EEDD /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 15732AAD16EA511900F3AC4C /* scutil-EmbeddedSimulator */;
+ targetProxy = 15631D2A1ECF99800088EEDD /* PBXContainerItemProxy */;
+ };
+ 15631D2D1ECF99A00088EEDD /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 15631D161ECF98FB0088EEDD /* configd_executables-EmbeddedSimulator */;
+ targetProxy = 15631D2C1ECF99A00088EEDD /* PBXContainerItemProxy */;
+ };
15732AE616EA6BCE00F3AC4C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 15732AD616EA6B6700F3AC4C /* libsystem_configuration-EmbeddedSimulator */;
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 */;
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = configdAggregateEmbedded;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = configdAggregateEmbedded;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
+ };
+ name = Release;
+ };
+ 151D06091EC1491600E02E48 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ EXECUTABLE_PREFIX = liblog_;
+ GENERATE_PROFILING_CODE_profile = YES;
+ INSTALLHDRS_COPY_PHASE = YES;
+ INSTALL_PATH = /usr/lib/log;
+ OTHER_CFLAGS_debug = "-O0";
+ PRODUCT_NAME = SystemConfiguration;
+ STRIP_INSTALLED_PRODUCT_asan = NO;
+ STRIP_INSTALLED_PRODUCT_debug = NO;
+ STRIP_INSTALLED_PRODUCT_normal = YES;
+ STRIP_INSTALLED_PRODUCT_profile = NO;
+ STRIP_INSTALLED_PRODUCT_tsan = NO;
+ };
+ name = Debug;
+ };
+ 151D060A1EC1491600E02E48 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ EXECUTABLE_PREFIX = liblog_;
+ GENERATE_PROFILING_CODE_profile = YES;
+ INSTALLHDRS_COPY_PHASE = YES;
+ INSTALL_PATH = /usr/lib/log;
+ OTHER_CFLAGS_debug = "-O0";
+ PRODUCT_NAME = SystemConfiguration;
+ STRIP_INSTALLED_PRODUCT_asan = NO;
+ STRIP_INSTALLED_PRODUCT_debug = NO;
+ STRIP_INSTALLED_PRODUCT_normal = YES;
+ STRIP_INSTALLED_PRODUCT_profile = NO;
+ STRIP_INSTALLED_PRODUCT_tsan = NO;
};
name = Release;
};
PRODUCT_NAME = genSCPreferences;
WARNING_CFLAGS = (
"-Wall",
+ "-Wextra",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
);
PRODUCT_NAME = genSCPreferences;
WARNING_CFLAGS = (
"-Wall",
+ "-Wextra",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
);
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_base (EmbeddedSimulator)";
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Debug;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_base (EmbeddedSimulator)";
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
PRODUCT_NAME = QoSMarking;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_NAME = QoSMarking;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.QoSMarking;
PRODUCT_NAME = QoSMarking;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.QoSMarking;
PRODUCT_NAME = QoSMarking;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
+ };
+ name = Release;
+ };
+ 15631D241ECF98FB0088EEDD /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
+ };
+ name = Debug;
+ };
+ 15631D251ECF98FB0088EEDD /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
"-lsystem_trace",
"-lxpc",
);
- OTHER_LDFLAGS_asan = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_osx_dynamic";
+ "OTHER_LDFLAGS_asan[arch=i386]" = "";
+ "OTHER_LDFLAGS_asan[sdk=iphoneos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_ios_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=iphonesimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_iossim_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=macosx*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_osx_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=tvos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_tvos_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=tvossimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_tvosossim_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=watchos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_watchos_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=watchsimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_watchossim_dynamic";
+ "OTHER_LDFLAGS_tsan[arch=i386]" = "";
+ "OTHER_LDFLAGS_tsan[sdk=iphoneos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_ios_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=iphonesimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_iossim_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=macosx*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_osx_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=tvos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_tvos_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=tvossimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_tvosossim_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=watchos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_watchos_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=watchsimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_watchossim_dynamic";
PRODUCT_NAME = libsystem_configuration;
STRIP_INSTALLED_PRODUCT_asan = NO;
STRIP_INSTALLED_PRODUCT_debug = NO;
STRIP_INSTALLED_PRODUCT_normal = YES;
STRIP_INSTALLED_PRODUCT_profile = NO;
+ STRIP_INSTALLED_PRODUCT_tsan = NO;
};
name = Debug;
};
"-lsystem_trace",
"-lxpc",
);
- OTHER_LDFLAGS_asan = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_osx_dynamic";
+ "OTHER_LDFLAGS_asan[arch=i386]" = "";
+ "OTHER_LDFLAGS_asan[sdk=iphoneos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_ios_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=iphonesimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_iossim_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=macosx*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_osx_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=tvos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_tvos_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=tvossimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_tvosossim_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=watchos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_watchos_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=watchsimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_watchossim_dynamic";
+ "OTHER_LDFLAGS_tsan[arch=i386]" = "";
+ "OTHER_LDFLAGS_tsan[sdk=iphoneos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_ios_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=iphonesimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_iossim_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=macosx*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_osx_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=tvos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_tvos_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=tvossimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_tvosossim_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=watchos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_watchos_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=watchsimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_watchossim_dynamic";
PRODUCT_NAME = libsystem_configuration;
STRIP_INSTALLED_PRODUCT_asan = NO;
STRIP_INSTALLED_PRODUCT_debug = NO;
STRIP_INSTALLED_PRODUCT_normal = YES;
STRIP_INSTALLED_PRODUCT_profile = NO;
+ STRIP_INSTALLED_PRODUCT_tsan = NO;
};
name = Release;
};
DEBUG_INFORMATION_FORMAT = dwarf;
INSTALL_PATH = /usr/local/lib/SystemConfiguration;
LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = (
+ "$(inherited)",
+ "-DSC_LOG_HANDLE=\"__log_InterfaceNamer()\"",
+ );
PRODUCT_NAME = InterfaceNamer;
STRIP_INSTALLED_PRODUCT = NO;
};
DEBUG_INFORMATION_FORMAT = dwarf;
INSTALL_PATH = /usr/local/lib/SystemConfiguration;
LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = (
+ "$(inherited)",
+ "-DSC_LOG_HANDLE=\"__log_InterfaceNamer()\"",
+ );
PRODUCT_NAME = InterfaceNamer;
STRIP_INSTALLED_PRODUCT = NO;
};
"-lIPMonitor$(EXECUTABLE_VARIANT_SUFFIX)",
"-lLinkConfiguration$(EXECUTABLE_VARIANT_SUFFIX)",
"-lPreferencesMonitor$(EXECUTABLE_VARIANT_SUFFIX)",
+ "-lQoSMarking$(EXECUTABLE_VARIANT_SUFFIX)",
);
PRODUCT_NAME = configd;
};
"-lIPMonitor$(EXECUTABLE_VARIANT_SUFFIX)",
"-lLinkConfiguration$(EXECUTABLE_VARIANT_SUFFIX)",
"-lPreferencesMonitor$(EXECUTABLE_VARIANT_SUFFIX)",
+ "-lQoSMarking$(EXECUTABLE_VARIANT_SUFFIX)",
);
PRODUCT_NAME = configd;
};
normal,
"${EXTRA_BUILD_VARIANT}",
);
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
"$(inherited)",
"DEBUG=1",
);
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = /usr/sbin;
INTERPOSITION_SIM_SUFFIX = "";
+ "INTERPOSITION_SIM_SUFFIX[sdk=bridgesimulator*]" = _sim;
"INTERPOSITION_SIM_SUFFIX[sdk=iphonesimulator*]" = _sim;
+ "INTERPOSITION_SIM_SUFFIX[sdk=tvossimulator*]" = _sim;
+ "INTERPOSITION_SIM_SUFFIX[sdk=watchsimulator*]" = _sim;
OTHER_CFLAGS = (
"$(inherited)",
"-fconstant-cfstrings",
"-DOS_ACTIVITY_OBJECT_API=1",
);
OTHER_CFLAGS_asan = "-fsanitize=address";
- OTHER_LDFLAGS_asan = "-fsanitize=address";
+ "OTHER_CFLAGS_asan[arch=i386]" = "";
+ OTHER_CFLAGS_tsan = "-fsanitize=thread";
+ "OTHER_CFLAGS_tsan[arch=i386]" = "";
+ OTHER_LDFLAGS_asan = "-fsanitize=address -headerpad_max_install_names";
+ "OTHER_LDFLAGS_asan[arch=i386]" = "";
+ OTHER_LDFLAGS_tsan = "-fsanitize=thread -headerpad_max_install_names";
+ "OTHER_LDFLAGS_tsan[arch=i386]" = "";
PLIST_FILE_OUTPUT_FORMAT = binary;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = macosx.internal;
VERSIONING_SYSTEM = "apple-generic";
WARNING_CFLAGS = (
"-Wall",
+ "-Wextra",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
"-Wformat-security",
normal,
"${EXTRA_BUILD_VARIANT}",
);
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)";
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = /usr/sbin;
INTERPOSITION_SIM_SUFFIX = "";
+ "INTERPOSITION_SIM_SUFFIX[sdk=bridgesimulator*]" = _sim;
"INTERPOSITION_SIM_SUFFIX[sdk=iphonesimulator*]" = _sim;
+ "INTERPOSITION_SIM_SUFFIX[sdk=tvossimulator*]" = _sim;
+ "INTERPOSITION_SIM_SUFFIX[sdk=watchsimulator*]" = _sim;
OTHER_CFLAGS = (
"$(inherited)",
"-fconstant-cfstrings",
"-DOS_ACTIVITY_OBJECT_API=1",
);
OTHER_CFLAGS_asan = "-fsanitize=address";
- OTHER_LDFLAGS_asan = "-fsanitize=address";
+ "OTHER_CFLAGS_asan[arch=i386]" = "";
+ OTHER_CFLAGS_tsan = "-fsanitize=thread";
+ "OTHER_CFLAGS_tsan[arch=i386]" = "";
+ OTHER_LDFLAGS_asan = "-fsanitize=address -headerpad_max_install_names";
+ "OTHER_LDFLAGS_asan[arch=i386]" = "";
+ OTHER_LDFLAGS_tsan = "-fsanitize=thread -headerpad_max_install_names";
+ "OTHER_LDFLAGS_tsan[arch=i386]" = "";
PLIST_FILE_OUTPUT_FORMAT = binary;
SDKROOT = macosx.internal;
SUPPORTED_PLATFORMS = macosx;
+ SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VERSIONING_SYSTEM = "apple-generic";
WARNING_CFLAGS = (
"-Wall",
+ "-Wextra",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
"-Wformat-security",
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration;
PRODUCT_NAME = SystemConfiguration;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=appletv*]" = NO;
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=iphone*]" = NO;
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=watch*]" = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration;
PRODUCT_NAME = SystemConfiguration;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=appletv*]" = NO;
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=iphone*]" = NO;
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=watch*]" = YES;
);
PRODUCT_NAME = configd_sim;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Debug;
};
);
PRODUCT_NAME = configd_sim;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
);
PRODUCT_NAME = scutil_sim;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Debug;
};
);
PRODUCT_NAME = scutil_sim;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT_normal = YES;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Debug;
};
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT_normal = YES;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
- INSTALL_PATH = /usr/sbin;
+ INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = scselect;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
- INSTALL_PATH = /usr/sbin;
+ INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = scselect;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
);
PRODUCT_NAME = scutil;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
);
PRODUCT_NAME = scutil;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
INSTALLHDRS_COPY_PHASE = YES;
INSTALL_PATH = /usr/lib/system;
INSTALL_PATH_asan = /usr/local/lib;
+ INSTALL_PATH_tsan = /usr/local/lib;
LINK_WITH_STANDARD_LIBRARIES = NO;
OTHER_LDFLAGS = (
"-Wl,-umbrella,System",
"-lxpc",
"-Wl,-upward-lSystem",
);
- "OTHER_LDFLAGS_asan[sdk=iphoneos*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_ios_dynamic";
- "OTHER_LDFLAGS_asan[sdk=iphonesimulator*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_iossim_dynamic";
- "OTHER_LDFLAGS_asan[sdk=tvos*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_tvos_dynamic";
- "OTHER_LDFLAGS_asan[sdk=tvossimulator*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_tvosossim_dynamic";
- "OTHER_LDFLAGS_asan[sdk=watchos*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_watchos_dynamic";
- "OTHER_LDFLAGS_asan[sdk=watchsimulator*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_watchossim_dynamic";
+ "OTHER_LDFLAGS_asan[arch=i386]" = "";
+ "OTHER_LDFLAGS_asan[sdk=iphoneos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_ios_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=iphonesimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_iossim_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=macosx*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_osx_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=tvos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_tvos_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=tvossimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_tvosossim_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=watchos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_watchos_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=watchsimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_watchossim_dynamic";
+ "OTHER_LDFLAGS_tsan[arch=i386]" = "";
+ "OTHER_LDFLAGS_tsan[sdk=iphoneos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_ios_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=iphonesimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_iossim_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=macosx*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_osx_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=tvos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_tvos_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=tvossimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_tvosossim_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=watchos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_watchos_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=watchsimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_watchossim_dynamic";
PRODUCT_NAME = libsystem_configuration;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT_asan = NO;
STRIP_INSTALLED_PRODUCT_normal = YES;
- SUPPORTED_PLATFORMS = "iphoneos tvos watchos";
+ STRIP_INSTALLED_PRODUCT_tsan = NO;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
INSTALLHDRS_COPY_PHASE = YES;
INSTALL_PATH = /usr/lib/system;
INSTALL_PATH_asan = /usr/local/lib;
+ INSTALL_PATH_tsan = /usr/local/lib;
LINK_WITH_STANDARD_LIBRARIES = NO;
OTHER_LDFLAGS = (
"-Wl,-umbrella,System",
"-lxpc",
"-Wl,-upward-lSystem",
);
- "OTHER_LDFLAGS_asan[sdk=iphoneos*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_ios_dynamic";
- "OTHER_LDFLAGS_asan[sdk=iphonesimulator*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_iossim_dynamic";
- "OTHER_LDFLAGS_asan[sdk=tvos*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_tvos_dynamic";
- "OTHER_LDFLAGS_asan[sdk=tvossimulator*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_tvosossim_dynamic";
- "OTHER_LDFLAGS_asan[sdk=watchos*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_watchos_dynamic";
- "OTHER_LDFLAGS_asan[sdk=watchsimulator*]" = "-headerpad_max_install_names -L${TOOLCHAIN_DIR}/usr/lib/clang/${CLANG_VERS}/lib/darwin -lclang_rt.asan_watchossim_dynamic";
+ "OTHER_LDFLAGS_asan[arch=i386]" = "";
+ "OTHER_LDFLAGS_asan[sdk=iphoneos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_ios_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=iphonesimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_iossim_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=macosx*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_osx_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=tvos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_tvos_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=tvossimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_tvosossim_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=watchos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_watchos_dynamic";
+ "OTHER_LDFLAGS_asan[sdk=watchsimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.asan_watchossim_dynamic";
+ "OTHER_LDFLAGS_tsan[arch=i386]" = "";
+ "OTHER_LDFLAGS_tsan[sdk=iphoneos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_ios_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=iphonesimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_iossim_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=macosx*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_osx_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=tvos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_tvos_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=tvossimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_tvosossim_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=watchos*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_watchos_dynamic";
+ "OTHER_LDFLAGS_tsan[sdk=watchsimulator*]" = "$(inherited) -L/usr/local/lib/sanitizers -lclang_rt.tsan_watchossim_dynamic";
PRODUCT_NAME = libsystem_configuration;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT_asan = NO;
STRIP_INSTALLED_PRODUCT_normal = YES;
- SUPPORTED_PLATFORMS = "iphoneos tvos watchos";
+ STRIP_INSTALLED_PRODUCT_tsan = NO;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_NAME = IPMonitor;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_NAME = IPMonitor;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
DEBUG_INFORMATION_FORMAT = dwarf;
INSTALL_PATH = /usr/local/lib/SystemConfiguration;
LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = (
+ "$(inherited)",
+ "-DSC_LOG_HANDLE=\"__log_IPMonitor()\"",
+ );
PRODUCT_NAME = InterfaceNamer;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
DEBUG_INFORMATION_FORMAT = dwarf;
INSTALL_PATH = /usr/local/lib/SystemConfiguration;
LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = (
+ "$(inherited)",
+ "-DSC_LOG_HANDLE=\"__log_IPMonitor()\"",
+ );
PRODUCT_NAME = InterfaceNamer;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_NAME = KernelEventMonitor;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_NAME = KernelEventMonitor;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_NAME = LinkConfiguration;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_NAME = LinkConfiguration;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_NAME = PreferencesMonitor;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_NAME = PreferencesMonitor;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_libSystem (EmbeddedSimulator)";
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Debug;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_libSystem (EmbeddedSimulator)";
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_base (Embedded)";
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_base (Embedded)";
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_plugins (Embedded)";
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_plugins (Embedded)";
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_executables (Embedded)";
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_executables (Embedded)";
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
);
PRODUCT_NAME = configd;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
);
PRODUCT_NAME = configd;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.IPMonitor;
PRODUCT_NAME = IPMonitor;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.IPMonitor;
PRODUCT_NAME = IPMonitor;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.InterfaceNamer;
PRODUCT_NAME = InterfaceNamer;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.InterfaceNamer;
PRODUCT_NAME = InterfaceNamer;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.KernelEventMonitor;
PRODUCT_NAME = KernelEventMonitor;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.KernelEventMonitor;
PRODUCT_NAME = KernelEventMonitor;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.LinkConfiguration;
PRODUCT_NAME = LinkConfiguration;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.LinkConfiguration;
PRODUCT_NAME = LinkConfiguration;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.PreferencesMonitor;
PRODUCT_NAME = PreferencesMonitor;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.PreferencesMonitor;
PRODUCT_NAME = PreferencesMonitor;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
"INSTALL_PATH[sdk=watch*]" = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/SystemConfiguration.framework";
PRODUCT_NAME = SCHelper;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
"INSTALL_PATH[sdk=watch*]" = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/SystemConfiguration.framework";
PRODUCT_NAME = SCHelper;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration;
PRODUCT_NAME = SystemConfiguration;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=appletv*]" = NO;
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=iphone*]" = NO;
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=watch*]" = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration;
PRODUCT_NAME = SystemConfiguration;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=appletv*]" = NO;
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=iphone*]" = NO;
"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK[sdk=watch*]" = YES;
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_libSystem (Embedded)";
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "configd_libSystem (Embedded)";
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
PRODUCT_NAME = SimulatorSupport_sim;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Debug;
};
PRODUCT_NAME = SimulatorSupport_sim;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.SimulatorSupport;
PRODUCT_NAME = SimulatorSupport;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Debug;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.SimulatorSupport;
PRODUCT_NAME = SimulatorSupport;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
PRODUCT_NAME = IPMonitor_sim;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Debug;
};
PRODUCT_NAME = IPMonitor_sim;
SDKROOT = iphoneos.internal;
STRIP_INSTALLED_PRODUCT = NO;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.IPMonitor;
PRODUCT_NAME = IPMonitor;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Debug;
};
PRODUCT_BUNDLE_IDENTIFIER = com.apple.SystemConfiguration.IPMonitor;
PRODUCT_NAME = IPMonitor;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
};
name = Release;
};
+ 15F742E21EC6370000DA2E7A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ EXECUTABLE_PREFIX = liblog_;
+ GENERATE_PROFILING_CODE_profile = YES;
+ INSTALLHDRS_COPY_PHASE = YES;
+ INSTALL_PATH = /usr/lib/log;
+ OTHER_CFLAGS_debug = "-O0";
+ PRODUCT_NAME = SystemConfiguration;
+ SDKROOT = iphoneos.internal;
+ STRIP_INSTALLED_PRODUCT_asan = NO;
+ STRIP_INSTALLED_PRODUCT_debug = NO;
+ STRIP_INSTALLED_PRODUCT_normal = YES;
+ STRIP_INSTALLED_PRODUCT_profile = NO;
+ STRIP_INSTALLED_PRODUCT_tsan = NO;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
+ };
+ name = Debug;
+ };
+ 15F742E31EC6370000DA2E7A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ EXECUTABLE_PREFIX = liblog_;
+ GENERATE_PROFILING_CODE_profile = YES;
+ INSTALLHDRS_COPY_PHASE = YES;
+ INSTALL_PATH = /usr/lib/log;
+ OTHER_CFLAGS_debug = "-O0";
+ PRODUCT_NAME = SystemConfiguration;
+ SDKROOT = iphoneos.internal;
+ STRIP_INSTALLED_PRODUCT_asan = NO;
+ STRIP_INSTALLED_PRODUCT_debug = NO;
+ STRIP_INSTALLED_PRODUCT_normal = YES;
+ STRIP_INSTALLED_PRODUCT_profile = NO;
+ STRIP_INSTALLED_PRODUCT_tsan = NO;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
+ };
+ name = Release;
+ };
+ 15F742EF1EC638D100DA2E7A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ EXECUTABLE_PREFIX = liblog_;
+ GENERATE_PROFILING_CODE_profile = YES;
+ INSTALLHDRS_COPY_PHASE = YES;
+ INSTALL_PATH = /usr/lib/log;
+ OTHER_CFLAGS_debug = "-O0";
+ PRODUCT_NAME = SystemConfiguration;
+ SDKROOT = iphoneos.internal;
+ STRIP_INSTALLED_PRODUCT_asan = NO;
+ STRIP_INSTALLED_PRODUCT_debug = NO;
+ STRIP_INSTALLED_PRODUCT_normal = YES;
+ STRIP_INSTALLED_PRODUCT_profile = NO;
+ STRIP_INSTALLED_PRODUCT_tsan = NO;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
+ };
+ name = Debug;
+ };
+ 15F742F01EC638D100DA2E7A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ EXECUTABLE_PREFIX = liblog_;
+ GENERATE_PROFILING_CODE_profile = YES;
+ INSTALLHDRS_COPY_PHASE = YES;
+ INSTALL_PATH = /usr/lib/log;
+ OTHER_CFLAGS_debug = "-O0";
+ PRODUCT_NAME = SystemConfiguration;
+ SDKROOT = iphoneos.internal;
+ STRIP_INSTALLED_PRODUCT_asan = NO;
+ STRIP_INSTALLED_PRODUCT_debug = NO;
+ STRIP_INSTALLED_PRODUCT_normal = YES;
+ STRIP_INSTALLED_PRODUCT_profile = NO;
+ STRIP_INSTALLED_PRODUCT_tsan = NO;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
+ };
+ name = Release;
+ };
15FD13C70D59485000F9409C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = configdAggregateEmbeddedSimulator;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Debug;
};
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = configdAggregateEmbeddedSimulator;
- SUPPORTED_PLATFORMS = iphonesimulator;
+ SUPPORTED_PLATFORMS = "iphonesimulator tvossimulator watchsimulator bridgesimulator";
};
name = Release;
};
PLIST_FILE_OUTPUT_FORMAT = "same-as-input";
PRODUCT_NAME = sctest;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Debug;
};
PLIST_FILE_OUTPUT_FORMAT = "same-as-input";
PRODUCT_NAME = sctest;
SDKROOT = iphoneos.internal;
- SUPPORTED_PLATFORMS = iphoneos;
+ SUPPORTED_PLATFORMS = "iphoneos tvos watchos bridgeos";
};
name = Release;
};
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 151D06081EC1491600E02E48 /* Build configuration list for PBXNativeTarget "liblog_SystemConfiguration" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 151D06091EC1491600E02E48 /* Debug */,
+ 151D060A1EC1491600E02E48 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
151F5D9F0CCE98E60093AC3B /* Build configuration list for PBXNativeTarget "SCMonitor" */ = {
isa = XCConfigurationList;
buildConfigurations = (
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 15631D231ECF98FB0088EEDD /* Build configuration list for PBXAggregateTarget "configd_executables-EmbeddedSimulator" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 15631D241ECF98FB0088EEDD /* Debug */,
+ 15631D251ECF98FB0088EEDD /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "libsystem_configuration" */ = {
isa = XCConfigurationList;
buildConfigurations = (
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 15F742E11EC6370000DA2E7A /* Build configuration list for PBXNativeTarget "liblog_SystemConfiguration-Embedded" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 15F742E21EC6370000DA2E7A /* Debug */,
+ 15F742E31EC6370000DA2E7A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 15F742EE1EC638D100DA2E7A /* Build configuration list for PBXNativeTarget "liblog_SystemConfiguration-EmbeddedSimulator" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 15F742EF1EC638D100DA2E7A /* Debug */,
+ 15F742F01EC638D100DA2E7A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
15FD13C60D59485000F9409C /* Build configuration list for PBXAggregateTarget "All-EmbeddedSimulator" */ = {
isa = XCConfigurationList;
buildConfigurations = (
/*
- * Copyright (c) 2004-2006, 2008, 2009, 2011-2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2006, 2008, 2009, 2011-2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <sys/socket.h>
#include <netinet/in.h>
-#define DNSINFO_VERSION 20160901
+#define DNSINFO_VERSION 20170629
#define DEFAULT_SEARCH_ORDER 200000 /* search order for the "default" resolver domain name */
DNS_VAR(uint32_t, reach_flags); /* SCNetworkReachabilityFlags */
DNS_VAR(uint32_t, service_identifier);
DNS_PTR(char *, cid); /* configuration identifer */
- DNS_VAR(uint32_t, reserved[2]);
+ DNS_PTR(char *, if_name); /* if_index interface name */
} dns_resolver_t;
#pragma pack()
DNS_VAR(uint64_t, generation);
DNS_VAR(int32_t, n_service_specific_resolver);
DNS_PTR(dns_resolver_t **, service_specific_resolver);
+ DNS_VAR(uint32_t, version);
} dns_config_t;
#pragma pack()
/*
- * Copyright (c) 2004, 2006, 2008-2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2004, 2006, 2008-2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <pthread.h>
#include <dispatch/dispatch.h>
#include <mach/mach.h>
+#ifdef VERBOSE_ACTIVITY_LOGGING
#include <os/activity.h>
+#endif // VERBOSE_ACTIVITY_LOGGING
#include <xpc/xpc.h>
+#ifndef SC_LOG_HANDLE
+#include <os/log.h>
+#define my_log(__level, __format, ...) os_log(OS_LOG_DEFAULT, __format, ## __VA_ARGS__)
+#endif // SC_LOG_HANDLE
+
#include "libSystemConfiguration_client.h"
#include "dnsinfo.h"
#include "dnsinfo_private.h"
static libSC_info_client_t *dnsinfo_client = NULL;
+#ifdef VERBOSE_ACTIVITY_LOGGING
static os_activity_t
__dns_configuration_activity()
{
return activity;
}
+#endif // VERBOSE_ACTIVITY_LOGGING
static dispatch_queue_t
dns_config_t *
dns_configuration_copy()
{
- uint8_t *buf = NULL;
- size_t bufLen;
- dns_config_t *config = NULL;
+ dns_config_t *dns_config = NULL;
+ _dns_config_buf_t *dns_config_buf = NULL;
static const char *proc_name = NULL;
xpc_object_t reqdict;
xpc_object_t reply;
return NULL;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
// scope DNS configuration activity
os_activity_scope(__dns_configuration_activity());
+#endif // VERBOSE_ACTIVITY_LOGGING
// create message
reqdict = xpc_dictionary_create(NULL, NULL, 0);
dataRef = xpc_dictionary_get_data(reply, DNSINFO_CONFIGURATION, &dataLen);
if ((dataRef != NULL) &&
((dataLen >= sizeof(_dns_config_buf_t)) && (dataLen <= DNS_CONFIG_BUF_MAX))) {
- _dns_config_buf_t *config = (_dns_config_buf_t *)(void *)dataRef;
- size_t configLen;
- uint32_t n_attribute = ntohl(config->n_attribute);
- uint32_t n_padding = ntohl(config->n_padding);
-
- /*
- * Check that the size of the configuration header plus the size of the
- * attribute data matches the size of the configuration buffer.
- *
- * If the sizes are different, something that should NEVER happen, CRASH!
- */
- configLen = sizeof(_dns_config_buf_t) + n_attribute;
- assert(configLen == dataLen);
-
- /*
- * Check that the size of the requested padding would not result in our
- * allocating a configuration + padding buffer larger than our maximum size.
- *
- * If the requested padding size is too large, something that should NEVER
- * happen, CRASH!
- */
- assert(n_padding <= (DNS_CONFIG_BUF_MAX - dataLen));
-
- /*
- * Check that the actual size of the configuration data and any requested
- * padding will be less than the maximum possible size of the in-memory
- * configuration buffer.
- *
- * If the length needed is too large, something that should NEVER happen, CRASH!
- */
- bufLen = dataLen + n_padding;
- assert(bufLen <= DNS_CONFIG_BUF_MAX);
-
- // allocate a buffer large enough to hold both the configuration
- // data and the padding.
- buf = malloc(bufLen);
- bcopy((void *)dataRef, buf, dataLen);
- bzero(&buf[dataLen], n_padding);
+ dns_config_buf = _dns_configuration_buffer_create(dataRef, dataLen);
}
xpc_release(reply);
}
- if (buf != NULL) {
- /* ALIGN: cast okay since _dns_config_buf_t is int aligned */
- config = _dns_configuration_expand_config((_dns_config_buf_t *)(void *)buf);
- if (config == NULL) {
- free(buf);
+ if (dns_config_buf != NULL) {
+ dns_config = _dns_configuration_buffer_expand(dns_config_buf);
+ if (dns_config == NULL) {
+ // if we were unable to expand the configuration
+ _dns_configuration_buffer_free(&dns_config_buf);
}
}
- return config;
+ return dns_config;
}
void
_dns_configuration_ack(dns_config_t *config, const char *bundle_id)
{
+#pragma unused(bundle_id)
xpc_object_t reqdict;
if (config == NULL) {
/*
- * Copyright (c) 2004-2006, 2009, 2011-2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2006, 2009, 2011-2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
_dns_config_buf_t *config;
config = calloc(1, INITIAL_CONFIGURATION_BUF_SIZE);
+ config->config.version = DNSINFO_VERSION;
config->config.generation = mach_absolute_time();
// config->n_attribute = 0;
// config->n_padding = 0;
{
_dns_config_buf_t *config = (_dns_config_buf_t *)*_config;
dns_attribute_t *header;
- int i;
uint32_t newLen;
uint32_t newSize;
uint32_t oldLen;
oldLen = ntohl(config->n_attribute);
rounded_length = ROUNDUP(attribute_length, sizeof(uint32_t));
newLen = sizeof(dns_attribute_t) + rounded_length;
- newSize = sizeof(_dns_config_buf_t) + oldLen + newLen;
+ newSize = sizeof(_dns_config_buf_t) + oldLen + newLen;
if (newSize > INITIAL_CONFIGURATION_BUF_SIZE) {
config = realloc(config, newSize);
}
// add attribute [data]
bcopy(attribute, &header->attribute[0], attribute_length);
- for (i = attribute_length; i < rounded_length; i++) {
+ for (uint32_t i = attribute_length; i < rounded_length; i++) {
header->attribute[i] = 0;
}
void *attribute)
{
dns_attribute_t *header;
- int i;
uint32_t newLen;
uint32_t newSize;
uint32_t oldLen;
// add attribute [data]
bcopy(attribute, &header->attribute[0], attribute_length);
- for (i = attribute_length; i < rounded_length; i++) {
+ for (uint32_t i = attribute_length; i < rounded_length; i++) {
header->attribute[i] = 0;
}
__private_extern__
void
-_dns_resolver_set_if_index(dns_create_resolver_t *_resolver, uint32_t if_index)
+_dns_resolver_set_if_index(dns_create_resolver_t *_resolver,
+ uint32_t if_index,
+ const char *if_name)
{
_dns_resolver_buf_t *resolver = (_dns_resolver_buf_t *)*_resolver;
resolver->resolver.if_index = htonl(if_index);
+ if (if_name != NULL) {
+ _dns_resolver_add_attribute(_resolver, RESOLVER_ATTRIBUTE_INTERFACE_NAME, (uint32_t)strlen(if_name), (void *)if_name);
+ }
return;
}
/*
- * Copyright (c) 2004-2006, 2008, 2009, 2011-2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2006, 2008, 2009, 2011-2013, 2015, 2017 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,
* 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@
*/
void
_dns_resolver_set_if_index (dns_create_resolver_t *_resolver,
- uint32_t if_index) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
+ uint32_t if_index,
+ const char *if_name) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
void
_dns_resolver_set_options (dns_create_resolver_t *_resolver,
/*
- * Copyright (c) 2009, 2011, 2012, 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2009, 2011, 2012, 2014, 2015, 2017 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,
* 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/socket.h>
#include <unistd.h>
+#ifdef MAIN
+#define my_log(__level, __format, ...) SCPrint(TRUE, stdout, CFSTR(__format "\n"), ## __VA_ARGS__)
+#endif // MAIN
+
#include "dnsinfo.h"
#include "dnsinfo_private.h"
#include "dnsinfo_create.h"
if (f == NULL) return NULL;
while ((buf = fgetln(f, &len)) != NULL) {
- int i;
char *lineptr;
int max_count;
int token;
// translate config token to enumerated value
token = -1;
- for (i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++) {
+ for (size_t i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++) {
if (strcasecmp(word, tokens[i].name) == 0) {
token = tokens[i].token;
max_count = tokens[i].max_count;
if_index = if_nametoindex(word);
if (if_index > 0) {
- _dns_resolver_set_if_index(&res, if_index);
+ _dns_resolver_set_if_index(&res, if_index, word);
}
break;
}
#ifdef MAIN
#undef MAIN
+#include "dnsinfo_logging.h"
#include "dnsinfo_copy.c"
int
main(int argc, char **argv)
{
- uint8_t *buf;
- dns_config_t *config;
- dns_create_config_t create_config;
- _dns_config_buf_t *config_buf;
- uint32_t n_config;
- uint32_t n_padding;
- dns_create_resolver_t resolver;
-
- resolver = _dnsinfo_flatfile_create_resolver(NULL, _PATH_RESCONF);
-
- create_config = _dns_configuration_create();
- _dnsinfo_flatfile_add_resolvers(&create_config);
-
- config_buf = (_dns_config_buf_t *)create_config;
- n_config = sizeof(_dns_config_buf_t) + ntohl(config_buf->n_attribute);
- n_padding = ntohl(config_buf->n_padding);
- buf = malloc(n_config + n_padding);
- bcopy((void *)config_buf, buf, n_config);
- bzero(&buf[n_config], n_padding);
- config = _dns_configuration_expand_config((_dns_config_buf_t *)buf);
+ dns_config_t *dns_config = NULL;
+ _dns_config_buf_t *dns_config_buf = NULL;
+ dns_create_config_t dns_create_config;
+ dns_create_resolver_t dns_create_resolver;
+
+ dns_create_resolver = _dnsinfo_flatfile_create_resolver(NULL, _PATH_RESCONF);
+ _dns_resolver_free(&dns_create_resolver);
+
+ dns_create_config = _dns_configuration_create();
+ if (dns_create_config != NULL) {
+ size_t n;
+
+ _dnsinfo_flatfile_add_resolvers(&dns_create_config);
+
+ n = sizeof(_dns_config_buf_t);
+ n += ntohl(((_dns_config_buf_t *)dns_create_config)->n_attribute);
+ dns_config_buf = _dns_configuration_buffer_create((void *)dns_create_config, n);
+ _dns_configuration_free(&dns_create_config);
+ }
+
+ if (dns_config_buf != NULL) {
+ dns_config = _dns_configuration_buffer_expand(dns_config_buf);
+ if (dns_config == NULL) {
+ // if we were unable to expand the configuration
+ _dns_configuration_buffer_free(&dns_config_buf);
+ }
+ }
+
+ if (dns_config != NULL) {
+ _dns_configuration_log(dns_config, TRUE, NULL);
+ free(dns_config);
+ }
return 0;
}
/*
- * Copyright (c) 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2013, 2015-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <sys/cdefs.h>
#include <SystemConfiguration/SystemConfiguration.h>
#include <SystemConfiguration/SCPrivate.h>
-#include "SCNetworkReachabilityInternal.h"
#include <arpa/inet.h>
#include <dnsinfo.h>
#include "dnsinfo_private.h"
+#define DNS_CONFIG_BUF_MAX 1024*1024
__BEGIN_DECLS
-
#ifndef my_log
-#define MY_LOG_DEFINED_LOCALLY
#define my_log(__level, __format, ...) SC_log(__level, __format, ## __VA_ARGS__)
+#define MY_LOG_DEFINED_LOCALLY
#endif // !my_log
-
-#define DNS_CONFIG_BUF_MAX 1024*1024
-
-
/*
* claim space for a list [of pointers] from the expanded DNS configuration padding
*/
static __inline__ boolean_t
-__dns_configuration_expand_add_list(void **padding, uint32_t *n_padding, int32_t count, int32_t size, void **list)
+__dns_configuration_expand_add_list(void **padding, uint32_t *n_padding, uint32_t count, uint32_t size, void **list)
{
- int32_t need;
+ uint32_t need;
need = count * size;
if (need > *n_padding) {
int32_t n_nameserver = 0;
int32_t n_search = 0;
int32_t n_sortaddr = 0;
+ void *ptr;
dns_resolver_t *resolver = (dns_resolver_t *)&buf->resolver;
if (n_buf < sizeof(_dns_resolver_buf_t)) {
n_padding,
resolver->n_nameserver,
sizeof(DNS_PTR(struct sockaddr *, x)),
- (void **)&resolver->nameserver)) {
+ &ptr)) {
goto error;
}
+ resolver->nameserver = ptr;
// initialize port
n_padding,
resolver->n_search,
sizeof(DNS_PTR(char *, x)),
- (void **)&resolver->search)) {
+ &ptr)) {
goto error;
}
+ resolver->search = ptr;
// initialize sortaddr list
n_padding,
resolver->n_sortaddr,
sizeof(DNS_PTR(dns_sortaddr_t *, x)),
- (void **)&resolver->sortaddr)) {
+ &ptr)) {
goto error;
}
+ resolver->sortaddr = ptr;
// initialize options
resolver->cid = (char *)&attribute->attribute[0];
break;
+ case RESOLVER_ATTRIBUTE_INTERFACE_NAME :
+ resolver->if_name = (char *)&attribute->attribute[0];
+ break;
+
default :
break;
}
}
+/*
+ * initialize a DNS "configuration" buffer
+ */
+static __inline__ _dns_config_buf_t *
+_dns_configuration_buffer_create(const void *dataRef, size_t dataLen)
+{
+ uint8_t *buf = NULL;
+ size_t bufLen;
+ _dns_config_buf_t *config = (_dns_config_buf_t *)dataRef;
+ size_t configLen;
+ uint32_t n_attribute = ntohl(config->n_attribute);
+ uint32_t n_padding = ntohl(config->n_padding);
+
+ /*
+ * Check that the size of the configuration header plus the size of the
+ * attribute data matches the size of the configuration buffer.
+ *
+ * If the sizes are different, something that should NEVER happen, CRASH!
+ */
+ configLen = sizeof(_dns_config_buf_t) + n_attribute;
+#ifdef DEBUG
+ assert(configLen == dataLen);
+#else // DEBUG
+ if (configLen != dataLen) {
+ my_log(LOG_ERR, "DNS configuration: size error (%zu != %zu)", configLen, dataLen);
+ return NULL;
+ }
+#endif // DEBUG
+
+ /*
+ * Check that the size of the requested padding would not result in our
+ * allocating a configuration + padding buffer larger than our maximum size.
+ *
+ * If the requested padding size is too large, something that should NEVER
+ * happen, CRASH!
+ */
+#ifdef DEBUG
+ assert(n_padding <= (DNS_CONFIG_BUF_MAX - dataLen));
+#else // DEBUG
+ if (n_padding > (DNS_CONFIG_BUF_MAX - dataLen)) {
+ my_log(LOG_ERR, "DNS configuration: padding error (%u > %zu)",
+ n_padding,
+ (DNS_CONFIG_BUF_MAX - dataLen));
+ return NULL;
+ }
+#endif // DEBUG
+
+ /*
+ * Check that the actual size of the configuration data and any requested
+ * padding will be less than the maximum possible size of the in-memory
+ * configuration buffer.
+ *
+ * If the length needed is too large, something that should NEVER happen, CRASH!
+ */
+ bufLen = dataLen + n_padding;
+#ifdef DEBUG
+ assert(bufLen <= DNS_CONFIG_BUF_MAX);
+#else // DEBUG
+ if (bufLen > DNS_CONFIG_BUF_MAX) {
+ my_log(LOG_ERR, "DNS configuration: length error (%zu > %u)",
+ bufLen,
+ DNS_CONFIG_BUF_MAX);
+ return NULL;
+ }
+#endif // DEBUG
+
+ // allocate a buffer large enough to hold both the configuration
+ // data and the padding.
+ buf = malloc(bufLen);
+ bcopy((void *)dataRef, buf, dataLen);
+ bzero(&buf[dataLen], n_padding);
+
+ return (_dns_config_buf_t *)(void *)buf;
+}
+
+
+/*
+ * expand a DNS "configuration" from the provided buffer
+ */
+static __inline__ void
+_dns_configuration_buffer_free(_dns_config_buf_t **buf)
+{
+ _dns_config_buf_t *config = (_dns_config_buf_t *)*buf;
+
+ free(config);
+ *buf = NULL;
+ return;
+}
+
+
/*
* expand a DNS "configuration" from the provided buffer
*/
static __inline__ dns_config_t *
-_dns_configuration_expand_config(_dns_config_buf_t *buf)
+_dns_configuration_buffer_expand(_dns_config_buf_t *buf)
{
dns_attribute_t *attribute;
dns_config_t *config = (dns_config_t *)buf;
int32_t n_scoped_resolver = 0;
int32_t n_service_specific_resolver = 0;
void *padding;
+ void *ptr;
n_attribute = ntohl(buf->n_attribute); // pre-validated (or known OK) at entry
n_padding = ntohl(buf->n_padding); // pre-validated (or known OK) at entry
&n_padding,
config->n_resolver,
sizeof(DNS_PTR(dns_resolver_t *, x)),
- (void **)&config->resolver)) {
+ &ptr)) {
goto error;
}
+ config->resolver = ptr;
config->n_scoped_resolver = ntohl(config->n_scoped_resolver);
if (!__dns_configuration_expand_add_list(&padding,
&n_padding,
config->n_scoped_resolver,
sizeof(DNS_PTR(dns_resolver_t *, x)),
- (void **)&config->scoped_resolver)) {
+ &ptr)) {
goto error;
}
+ config->scoped_resolver = ptr;
config->n_service_specific_resolver = ntohl(config->n_service_specific_resolver);
if (!__dns_configuration_expand_add_list(&padding,
&n_padding,
config->n_service_specific_resolver,
sizeof(DNS_PTR(dns_resolver_t *, x)),
- (void **)&config->service_specific_resolver)) {
+ &ptr)) {
goto error;
}
+ config->service_specific_resolver = ptr;
// process configuration buffer "attribute" data
return NULL;
}
-
-static __inline__ void
-_dns_resolver_log(dns_resolver_t *resolver, int index, Boolean debug)
-{
- int i;
- uint32_t flags;
- CFMutableStringRef str;
-
- my_log(LOG_INFO, " ");
- my_log(LOG_INFO, "resolver #%d", index);
-
- if (resolver->domain != NULL) {
- my_log(LOG_INFO, " domain : %s", resolver->domain);
- }
-
- for (i = 0; i < resolver->n_search; i++) {
- my_log(LOG_INFO, " search domain[%d] : %s", i, resolver->search[i]);
- }
-
- for (i = 0; i < resolver->n_nameserver; i++) {
- char buf[128];
-
- _SC_sockaddr_to_string(resolver->nameserver[i], buf, sizeof(buf));
- my_log(LOG_INFO, " nameserver[%d] : %s", i, buf);
- }
-
- for (i = 0; i < resolver->n_sortaddr; i++) {
- char abuf[32];
- char mbuf[32];
-
- (void)inet_ntop(AF_INET, &resolver->sortaddr[i]->address, abuf, sizeof(abuf));
- (void)inet_ntop(AF_INET, &resolver->sortaddr[i]->mask, mbuf, sizeof(mbuf));
- my_log(LOG_INFO, " sortaddr[%d] : %s/%s", i, abuf, mbuf);
- }
-
- if (resolver->options != NULL) {
- my_log(LOG_INFO, " options : %s", resolver->options);
- }
-
- if (resolver->port != 0) {
- my_log(LOG_INFO, " port : %hd", resolver->port);
- }
-
- if (resolver->timeout != 0) {
- my_log(LOG_INFO, " timeout : %d", resolver->timeout);
- }
-
- if (resolver->if_index != 0) {
- char buf[IFNAMSIZ];
- char *if_name;
-
- if_name = if_indextoname(resolver->if_index, buf);
- my_log(LOG_INFO, " if_index : %d (%s)",
- resolver->if_index,
- (if_name != NULL) ? if_name : "?");
- }
-
- if (resolver->service_identifier != 0) {
- my_log(LOG_INFO, " service_identifier : %d",
- resolver->service_identifier);
- }
-
- flags = resolver->flags;
- str = CFStringCreateMutable(NULL, 0);
- CFStringAppend(str, CFSTR(" flags : "));
- if (debug) {
- CFStringAppendFormat(str, NULL, CFSTR("0x%08x ("), flags);
- }
- if (flags & DNS_RESOLVER_FLAGS_SCOPED) {
- flags &= ~DNS_RESOLVER_FLAGS_SCOPED;
- CFStringAppendFormat(str, NULL, CFSTR("Scoped%s"), flags != 0 ? ", " : "");
- }
- if (flags & DNS_RESOLVER_FLAGS_SERVICE_SPECIFIC) {
- flags &= ~DNS_RESOLVER_FLAGS_SERVICE_SPECIFIC;
- CFStringAppendFormat(str, NULL, CFSTR("Service-specific%s"), flags != 0 ? ", " : "");
- }
- if (flags & DNS_RESOLVER_FLAGS_SUPPLEMENTAL) {
- flags &= ~DNS_RESOLVER_FLAGS_SUPPLEMENTAL;
- CFStringAppendFormat(str, NULL, CFSTR("Supplemental%s"), flags != 0 ? ", " : "");
- }
- if (flags & DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS) {
- flags &= ~DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS;
- CFStringAppendFormat(str, NULL, CFSTR("Request A records%s"), flags != 0 ? ", " : "");
- }
- if (flags & DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS) {
- flags &= ~DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS;
- CFStringAppendFormat(str, NULL, CFSTR("Request AAAA records%s"), flags != 0 ? ", " : "");
- }
- if (flags != 0) {
- CFStringAppendFormat(str, NULL, CFSTR("0x%08x"), flags);
- }
- if (debug) {
- CFStringAppend(str, CFSTR(")"));
- }
- my_log(LOG_INFO, "%@", str);
- CFRelease(str);
-
- str = (CFMutableStringRef)__SCNetworkReachabilityCopyFlags(resolver->reach_flags,
- CFSTR(" reach : "),
- debug);
- my_log(LOG_INFO, "%@", str);
- CFRelease(str);
-
- if (resolver->search_order != 0) {
- my_log(LOG_INFO, " order : %d", resolver->search_order);
- }
-
- if (debug && (resolver->cid != NULL)) {
- my_log(LOG_INFO, " config id: %s", resolver->cid);
- }
-
- return;
-}
-
-
-static __inline__ void
-_dns_configuration_log(dns_config_t *dns_config, Boolean debug)
-{
- int i;
-
- my_log(LOG_INFO, "DNS configuration");
-
- for (i = 0; i < dns_config->n_resolver; i++) {
- dns_resolver_t *resolver = dns_config->resolver[i];
-
- _dns_resolver_log(resolver, i + 1, debug);
- }
-
- if ((dns_config->n_scoped_resolver > 0) && (dns_config->scoped_resolver != NULL)) {
- my_log(LOG_INFO, " ");
- my_log(LOG_INFO, "DNS configuration (for scoped queries)");
-
- for (i = 0; i < dns_config->n_scoped_resolver; i++) {
- dns_resolver_t *resolver = dns_config->scoped_resolver[i];
-
- _dns_resolver_log(resolver, i + 1, debug);
- }
- }
-
- if ((dns_config->n_service_specific_resolver > 0) && (dns_config->service_specific_resolver != NULL)) {
- my_log(LOG_INFO, " ");
- my_log(LOG_INFO, "DNS configuration (for service-specific queries)");
-
- for (i = 0; i < dns_config->n_service_specific_resolver; i++) {
- dns_resolver_t *resolver = dns_config->service_specific_resolver[i];
-
- _dns_resolver_log(resolver, i + 1, debug);
- }
- }
-
- return;
-}
-
-
#ifdef MY_LOG_DEFINED_LOCALLY
#undef my_log
#undef MY_LOG_DEFINED_LOCALLY
#endif // MY_LOG_DEFINED_LOCALLY
-
__END_DECLS
#endif /* !_S_DNSINFO_INTERNAL_H */
--- /dev/null
+/*
+ * Copyright (c) 2017 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 _S_DNSINFO_LOGGING_H
+#define _S_DNSINFO_LOGGING_H
+
+#include <Availability.h>
+#include <TargetConditionals.h>
+#include <sys/cdefs.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCPrivate.h>
+#include "SCNetworkReachabilityLogging.h"
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <net/if_var.h>
+
+#include <dnsinfo.h>
+#include "dnsinfo_private.h"
+
+__BEGIN_DECLS
+
+#ifndef my_log
+#define my_log(__level, __format, ...) SC_log(__level, __format, ## __VA_ARGS__)
+#define MY_LOG_DEFINED_LOCALLY
+#endif // !my_log
+
+#ifndef my_log_context_type
+#define MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY
+#define my_log_context_type void *
+#endif // !my_log_context_type
+
+#ifndef my_log_context_name
+#define MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY
+#define my_log_context_name context
+#endif // !my_log_context_name
+
+static __inline__ void
+_dns_resolver_log(uint32_t version, dns_resolver_t *resolver, int index, Boolean debug, my_log_context_type my_log_context_name)
+{
+#if defined(MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY) && defined(MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY)
+#pragma unused(my_log_context_name)
+#endif
+ int i;
+ uint32_t flags;
+ char reach_str[100];
+ CFMutableStringRef str;
+
+ my_log(LOG_INFO, "%s", "");
+ my_log(LOG_INFO, "resolver #%d", index);
+
+ if (resolver->domain != NULL) {
+ my_log(LOG_INFO, " domain : %s", resolver->domain);
+ }
+
+ for (i = 0; i < resolver->n_search; i++) {
+ my_log(LOG_INFO, " search domain[%d] : %s", i, resolver->search[i]);
+ }
+
+ for (i = 0; i < resolver->n_nameserver; i++) {
+ char buf[128];
+
+ _SC_sockaddr_to_string(resolver->nameserver[i], buf, sizeof(buf));
+ my_log(LOG_INFO, " nameserver[%d] : %s", i, buf);
+ }
+
+ for (i = 0; i < resolver->n_sortaddr; i++) {
+ char abuf[32];
+ char mbuf[32];
+
+ (void)inet_ntop(AF_INET, &resolver->sortaddr[i]->address, abuf, sizeof(abuf));
+ (void)inet_ntop(AF_INET, &resolver->sortaddr[i]->mask, mbuf, sizeof(mbuf));
+ my_log(LOG_INFO, " sortaddr[%d] : %s/%s", i, abuf, mbuf);
+ }
+
+ if (resolver->options != NULL) {
+ my_log(LOG_INFO, " options : %s", resolver->options);
+ }
+
+ if (resolver->port != 0) {
+ my_log(LOG_INFO, " port : %hd", resolver->port);
+ }
+
+ if (resolver->timeout != 0) {
+ my_log(LOG_INFO, " timeout : %d", resolver->timeout);
+ }
+
+ if (resolver->if_index != 0) {
+#ifndef _LIBLOG_SYSTEMCONFIGURATION_
+ char buf[IFNAMSIZ];
+#endif // !_LIBLOG_SYSTEMCONFIGURATION_
+ char *if_name = NULL;
+
+ if ((version >= 20170629) && (resolver->if_name != NULL)) {
+ if_name = resolver->if_name;
+#ifndef _LIBLOG_SYSTEMCONFIGURATION_
+ } else {
+ if_name = if_indextoname(resolver->if_index, buf);
+#endif // !_LIBLOG_SYSTEMCONFIGURATION_
+ }
+ my_log(LOG_INFO, " if_index : %d (%s)",
+ resolver->if_index,
+ (if_name != NULL) ? if_name : "?");
+ }
+
+ if (resolver->service_identifier != 0) {
+ my_log(LOG_INFO, " service_identifier : %d",
+ resolver->service_identifier);
+ }
+
+ flags = resolver->flags;
+ str = CFStringCreateMutable(NULL, 0);
+ CFStringAppend(str, CFSTR(" flags : "));
+ if (debug) {
+ CFStringAppendFormat(str, NULL, CFSTR("0x%08x"), flags);
+ }
+ if (flags != 0) {
+ if (debug) {
+ CFStringAppendFormat(str, NULL, CFSTR(" ("));
+ }
+ if (flags & DNS_RESOLVER_FLAGS_SCOPED) {
+ flags &= ~DNS_RESOLVER_FLAGS_SCOPED;
+ CFStringAppendFormat(str, NULL, CFSTR("Scoped%s"), flags != 0 ? ", " : "");
+ }
+ if (flags & DNS_RESOLVER_FLAGS_SERVICE_SPECIFIC) {
+ flags &= ~DNS_RESOLVER_FLAGS_SERVICE_SPECIFIC;
+ CFStringAppendFormat(str, NULL, CFSTR("Service-specific%s"), flags != 0 ? ", " : "");
+ }
+ if (flags & DNS_RESOLVER_FLAGS_SUPPLEMENTAL) {
+ flags &= ~DNS_RESOLVER_FLAGS_SUPPLEMENTAL;
+ CFStringAppendFormat(str, NULL, CFSTR("Supplemental%s"), flags != 0 ? ", " : "");
+ }
+ if (flags & DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS) {
+ flags &= ~DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS;
+ CFStringAppendFormat(str, NULL, CFSTR("Request A records%s"), flags != 0 ? ", " : "");
+ }
+ if (flags & DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS) {
+ flags &= ~DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS;
+ CFStringAppendFormat(str, NULL, CFSTR("Request AAAA records%s"), flags != 0 ? ", " : "");
+ }
+ if (flags != 0) {
+ CFStringAppendFormat(str, NULL, CFSTR("0x%08x"), flags);
+ }
+ if (debug) {
+ CFStringAppend(str, CFSTR(")"));
+ }
+ }
+ my_log(LOG_INFO, "%@", str);
+ CFRelease(str);
+
+ __SCNetworkReachability_flags_string(resolver->reach_flags, TRUE, reach_str, sizeof(reach_str));
+ my_log(LOG_INFO, " reach : %s", reach_str);
+
+ if (resolver->search_order != 0) {
+ my_log(LOG_INFO, " order : %d", resolver->search_order);
+ }
+
+ if (debug && (resolver->cid != NULL)) {
+ my_log(LOG_INFO, " config id: %s", resolver->cid);
+ }
+
+ return;
+}
+
+static __inline__ void
+_dns_configuration_log(dns_config_t *dns_config, Boolean debug, my_log_context_type my_log_context_name)
+{
+#if defined(MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY) && defined(MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY)
+#pragma unused(my_log_context_name)
+#endif
+ int i;
+
+ my_log(LOG_INFO, "%s", "DNS configuration");
+
+ for (i = 0; i < dns_config->n_resolver; i++) {
+ dns_resolver_t *resolver = dns_config->resolver[i];
+
+ _dns_resolver_log(dns_config->version, resolver, i + 1, debug, my_log_context_name);
+ }
+
+ if ((dns_config->n_scoped_resolver > 0) && (dns_config->scoped_resolver != NULL)) {
+ my_log(LOG_INFO, "%s", "");
+ my_log(LOG_INFO, "%s", "DNS configuration (for scoped queries)");
+
+ for (i = 0; i < dns_config->n_scoped_resolver; i++) {
+ dns_resolver_t *resolver = dns_config->scoped_resolver[i];
+
+ _dns_resolver_log(dns_config->version, resolver, i + 1, debug, my_log_context_name);
+ }
+ }
+
+ if ((dns_config->n_service_specific_resolver > 0) && (dns_config->service_specific_resolver != NULL)) {
+ my_log(LOG_INFO, "%s", "");
+ my_log(LOG_INFO, "%s", "DNS configuration (for service-specific queries)");
+
+ for (i = 0; i < dns_config->n_service_specific_resolver; i++) {
+ dns_resolver_t *resolver = dns_config->service_specific_resolver[i];
+
+ _dns_resolver_log(dns_config->version, resolver, i + 1, debug, my_log_context_name);
+ }
+ }
+
+ return;
+}
+
+#ifdef MY_LOG_DEFINED_LOCALLY
+#undef my_log
+#undef MY_LOG_DEFINED_LOCALLY
+#endif // MY_LOG_DEFINED_LOCALLY
+
+#ifdef MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY
+#undef my_log_context_type
+#undef MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY
+#endif // MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY
+
+#ifdef MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY
+#undef my_log_context_name
+#undef MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY
+#endif // MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY
+
+__END_DECLS
+
+#endif /* !_S_DNSINFO_LOGGING_H */
/*
- * Copyright (c) 2004-2006, 2008, 2009, 2012, 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2006, 2008, 2009, 2012, 2013, 2015, 2017 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,
* 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@
*/
* | 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 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"
- * | | | +-------------------+-----------------------------+
- * | | | | generation | uint64_t | <- generation # of configuration
- * | | | +-------------------+---------+-------------------+
+ * | | +-+-----------------------------+-------------------+
+ * | | | | 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"
+ * | | | +-----------------------------+--------------------+
+ * | | | | generation | uint64_t | <- generation # of configuration
+ * | | | +-----------------------------+-------------------+
* | | | | n_service_specific_resolver | int32_t | <- # of name service-specific resolvers
* | | | +-------------------+---------+-------------------+
* | | | | service_specific_resolver | dns_resolver_t ** | <- not used during creation, filled
* | | | | | | in with pointer to a list of service-specific
* | | | | | | resolver configurations that will be
* | | | | | | established in the "padding"
- * | | | +-------------------+---------+-------------------+
- * | | | | ... | ... |
- * | +-------------+-+-------------------+-----------------------------+
+ * | | | +-----------------------------+-------------------+
+ * | | | | version | uint32_t | <- configuration structure(s) version
+ * | +-------------+-+-----------------------------+-------------------+
* | | n_attribute | uint32_t | <- how many bytes of "attribute"
* | | | | data is associated with the
* | | | | configuration
RESOLVER_ATTRIBUTE_SORTADDR,
RESOLVER_ATTRIBUTE_OPTIONS,
RESOLVER_ATTRIBUTE_CONFIGURATION_ID,
+ RESOLVER_ATTRIBUTE_INTERFACE_NAME,
};
/*
- * Copyright (c) 2004-2008, 2011-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2008, 2011-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <bsm/libbsm.h>
#include <dispatch/dispatch.h>
#include <xpc/xpc.h>
+#include <os/state_private.h>
#include <CoreFoundation/CoreFoundation.h>
#include <SystemConfiguration/SCPrivate.h>
}
+#pragma mark -
+#pragma mark DNS configuration state
+
+
+static void
+add_state_handler()
+{
+#if !TARGET_OS_SIMULATOR
+ os_state_block_t state_block;
+ os_state_handle_t state_handle;
+
+ state_block = ^os_state_data_t(os_state_hints_t hints) {
+#pragma unused(hints)
+ CFIndex dnsinfo_len;
+ os_state_data_t state_data;
+ size_t state_data_size;
+
+ dnsinfo_len = (S_dns_info.data != NULL) ? CFDataGetLength(S_dns_info.data) : 0;
+ state_data_size = OS_STATE_DATA_SIZE_NEEDED(dnsinfo_len);
+ if (state_data_size > MAX_STATEDUMP_SIZE) {
+ SC_log(LOG_ERR, "DNS configuration: state data too large (%zd > %zd)",
+ state_data_size,
+ MAX_STATEDUMP_SIZE);
+ return NULL;
+ }
+
+ state_data = calloc(1, state_data_size);
+ if (state_data == NULL) {
+ SC_log(LOG_ERR, "DNS configuration: could not allocate state data");
+ return NULL;
+ }
+
+ state_data->osd_type = OS_STATE_DATA_CUSTOM;
+ state_data->osd_data_size = (uint32_t)dnsinfo_len;
+ strlcpy(state_data->osd_decoder.osdd_library,
+ "SystemConfiguration",
+ sizeof(state_data->osd_decoder.osdd_library));
+ strlcpy(state_data->osd_decoder.osdd_type,
+ "dnsinfo",
+ sizeof(state_data->osd_decoder.osdd_type));
+ strlcpy(state_data->osd_title, "DNS Configuration", sizeof(state_data->osd_title));
+ if (dnsinfo_len > 0) {
+ memcpy(state_data->osd_data, CFDataGetBytePtr(S_dns_info.data), dnsinfo_len);
+ }
+
+ return state_data;
+ };
+
+ state_handle = os_state_add_handler(_dnsinfo_server_queue(), state_block);
+ if (state_handle == 0) {
+ SC_log(LOG_ERR, "DNS configuration: os_state_add_handler() failed");
+ }
+#endif // !TARGET_OS_SIMULATOR
+
+
+ return;
+}
+
+
#pragma mark -
#pragma mark DNS configuration server SPIs
load_DNSConfiguration(CFBundleRef bundle,
_dns_sync_handler_t syncHandler)
{
+#pragma unused(bundle)
xpc_connection_t c;
const char *name;
*/
_libSC_info_server_init(&S_dns_info);
+ /*
+ * add a state dump handler
+ */
+ add_state_handler();
+
/*
* save the in-sync/not-in-sync handler
*/
} else {
SC_log(LOG_ERR, "DNS configuration server: unknown event type : %p", type);
-
}
});
if [ -d ~/Desktop ]; then
OUTDIR=~/Desktop
elif [ "`readlink /tmp`" = "private/var/tmp" ]; then
- OUTDIR=/Library/Logs/CrashReporter
+ OUTDIR=/Library/Logs/DiagnosticReports
+ if [ ! -d /Library/Logs/DiagnosticReports -a -d /Library/Logs/CrashReporter ]; then
+ OUTDIR=/Library/Logs/CrashReporter
+ fi
mkdir -p ${OUTDIR}
fi
fi
#
# collect packet capture with kernel ring buffer if available
#
+stop_pcap () {
+ #
+ # Stop the packet capture
+ #
+ if [ ${PCAP_STARTED} -ne 0 ]; then
+ trap '' SIGINT
+ /usr/local/bin/netdiagnose stop packetcapture 2>&1
+ PCAP_STARTED=0
+ fi
+}
+
+PCAP_STARTED=0
if [ -x /usr/local/bin/netdiagnose -a ${NO_PCAP} -ne 1 ]; then
+ trap stop_pcap SIGINT
/usr/local/bin/netdiagnose -p "${WORKDIR}" start packetcapture 2>&1
+ PCAP_STARTED=1
fi
#
#
# Stop the packet capture
#
-if [ -x /usr/local/bin/netdiagnose -a ${NO_PCAP} -ne 1 ]; then
- /usr/local/bin/netdiagnose stop packetcapture 2>&1
-fi
+stop_pcap
if [ $NO_TAR -eq 0 ]; then
#
#!/bin/sh
#
-# Copyright © 2015, 2016 Apple Inc.
+# Copyright © 2015-2017 Apple Inc.
#
# get-network-info
#
}
+#
+# skywalk configuration and statistics
+#
+run_skywalk () {
+
+ if [ ! -x /usr/sbin/skywalkctl ]; then
+ return
+ fi
+
+ echo "#" > skywalk.txt
+ echo "# skywalkctl list-providers -D" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl list-providers -D >> skywalk.txt 2>&1
+
+ echo "#" >> skywalk.txt
+ echo "# skywalkctl channel-stats" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl channel-stats >> skywalk.txt 2>&1
+
+ echo "#" >> skywalk.txt
+ echo "# skywalkctl netstat -a -n" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl netstat -a -n >> skywalk.txt 2>&1
+
+ echo "#" >> skywalk.txt
+ echo "# skywalkctl netstat -s" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl netstat -s >> skywalk.txt 2>&1
+
+ echo "#" >> skywalk.txt
+ echo "# skywalkctl netstat -s --global" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl netstat -s --global >> skywalk.txt 2>&1
+
+ echo "#" >> skywalk.txt
+ echo "# skywalkctl netstat --netif" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl netstat --netif >> skywalk.txt 2>&1
+
+ echo "#" >> skywalk.txt
+ echo "# skywalkctl netstat --flowswitch" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl netstat --flowswitch >> skywalk.txt 2>&1
+
+ echo "#" >> skywalk.txt
+ echo "# skywalkctl netstat --flow-adv" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl netstat --flow-adv >> skywalk.txt 2>&1
+
+ echo "#" >> skywalk.txt
+ echo "# skywalkctl netstat --flow-owner" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl netstat --flow-owner >> skywalk.txt 2>&1
+
+ echo "#" >> skywalk.txt
+ echo "# skywalkctl netns -a" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl netns -a >> skywalk.txt 2>&1
+
+ echo "#" >> skywalk.txt
+ echo "# skywalkctl memory" >> skywalk.txt
+ echo "#" >> skywalk.txt
+ /usr/sbin/skywalkctl memory >> skywalk.txt 2>&1
+
+}
+
+#
+# skywalk configuration and statistics
+#
+run_nettop () {
+
+ if [ ! -x /usr/bin/nettop ]; then
+ return
+ fi
+
+ echo "#" > nettop.txt
+ echo "# nettop -U -l 1" >> nettop.txt
+ echo "#" >> nettop.txt
+ /usr/bin/nettop -U -l 1 >> nettop.txt 2>&1
+
+}
+
#
# Network preferences
#
/Library/Preferences/com.apple.networkextension.plist \
/Library/Preferences/com.apple.networkextension.control.plist \
/Library/Preferences/com.apple.networkextension.necp.plist \
+ /Library/Preferences/com.apple.networkextension.cache.plist \
/Library/Preferences/SystemConfiguration/com.apple.nat.plist \
/Library/Preferences/SystemConfiguration/com.apple.RemoteAccessServers.plist \
/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist \
return
fi
- echo "#" > necp.txt
- echo "# neutil policy dump" >> necp.txt
- echo "#" >> necp.txt
- /usr/local/bin/neutil policy dump >> necp.txt 2>&1
-
- echo "#" > network-agents.txt
- echo "# neutil agent dump" >> network-agents.txt
- echo "#" >> network-agents.txt
- /usr/local/bin/neutil agent dump >> network-agents.txt 2>&1
-
+ (
+ echo "#" > necp.txt
+ echo "# neutil policy dump" >> necp.txt
+ echo "#" >> necp.txt
+ /usr/local/bin/neutil policy dump >> necp.txt 2>&1
+
+ echo "#" > network-agents.txt
+ echo "# neutil agent dump" >> network-agents.txt
+ echo "#" >> network-agents.txt
+ /usr/local/bin/neutil agent dump >> network-agents.txt 2>&1
+ ) &
}
#
echo "#" >> nc-info.txt
/usr/sbin/scutil --nc list >> nc-info.txt 2>&1
- ${PRIV} /usr/sbin/scutil -p --snapshot
- 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.plist ]; then
- cat /var/tmp/configd-pattern.plist > configd-pattern.plist 2>&1
- fi
- 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
+ /usr/sbin/scutil -p --snapshot SCDynamicStore.plist 2>&1
}
}
start_pcap() {
-
#
# collect a packet capture if netdiagnose is available
#
if [ -x /usr/local/bin/netdiagnose ]; then
- /usr/local/bin/netdiagnose -p "${REQUESTED_OUTDIR}" start sysdiagpcap 2>&1
-
+ trap stop_pcap SIGINT
+ /usr/local/bin/netdiagnose -p "${REQUESTED_OUTDIR}" start sysdiagpcap 2>&1 1>/dev/null
PCAP_STARTED=1
fi
}
stop_pcap () {
if [ ${PCAP_STARTED} -ne 0 ]; then
- /usr/local/bin/netdiagnose stop sysdiagpcap 2>&1
+ trap '' SIGINT
+ /usr/local/bin/netdiagnose stop sysdiagpcap 2>&1 1>/dev/null
fi
}
run_ndp
run_arp
run_neutil
+ run_nettop
run_network_test
}
run_netstat
run_ipconfig
run_setkey
+ run_skywalk
collect_vpn_logs
run_route
run_hostname
is_outdir_valid () {
- if [ ! -d ${REQUESTED_OUTDIR} ] ||
- [ "${REQUESTED_OUTDIR}" = "" ]; then
+ if [ "${REQUESTED_OUTDIR}" = "" ]; then
usage
exit 1
fi
+ if [ ! -d ${REQUESTED_OUTDIR} ]; then
+ echo "${REQUESTED_OUTDIR} does not exist"
+ exit 1
+ fi
+
if [ ! -w ${REQUESTED_OUTDIR} ]; then
echo "${REQUESTED_OUTDIR} is write-protected"
exit 1
--- /dev/null
+/*
+ * Copyright (c) 2017 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
+ *
+ * May 18, 2017 Allan Nathanson <ajn@apple.com>
+ * - initial revision
+ */
+
+#define _LIBLOG_SYSTEMCONFIGURATION_
+
+#import <Foundation/Foundation.h>
+#import <os/log_private.h>
+#import <os/state_private.h>
+#import <string.h>
+
+#import <dnsinfo.h>
+#import "dnsinfo_internal.h"
+#import <network_information.h>
+
+#define my_log(__level, __format, ...) [string appendFormat:@(__format "\n"), ## __VA_ARGS__]
+#define my_log_context_type NSMutableString *
+#define my_log_context_name string
+#import "dnsinfo_logging.h"
+#import "network_state_information_logging.h"
+#undef my_log_context_name
+#undef my_log_context_type
+#undef my_log
+
+#define SCAS(str) \
+ [[NSAttributedString alloc] initWithString:str]
+
+#define SCASWithFormat(format, ...) \
+ SCAS(([[NSString alloc] initWithFormat:format, ##__VA_ARGS__]))
+
+#pragma mark -
+#pragma mark os_log formatting entry point
+
+struct SC_OSLog_Formatters {
+ const char *type;
+ NS_RETURNS_RETAINED NSAttributedString * (*function)(id value);
+};
+
+NS_RETURNS_RETAINED
+NSAttributedString *
+OSLogCopyFormattedString(const char *type, id value, os_log_type_info_t info)
+{
+#pragma unused(info)
+ // add functions for each type into this list
+ static const struct SC_OSLog_Formatters formatters[] = {
+// { .type = "???", .function = _SC_OSLogCopyFormattedString_??? },
+ };
+
+ for (int i = 0; i < (int)(sizeof(formatters) / sizeof(formatters[0])); i++) {
+ if (strcmp(type, formatters[i].type) == 0) {
+ return formatters[i].function(value);
+ }
+ }
+
+ return SCASWithFormat(@"liblog_SystemConfiguration: Not yet supported os_log formatting type: %s", type);
+}
+
+#pragma mark -
+#pragma mark os_state formatting entry point
+
+#define SCNS(str) \
+ [[NSString alloc] initWithString:(str)]
+
+#define SCNSWithFormat(format, ...) \
+ [[NSString alloc] initWithFormat:format, ##__VA_ARGS__]
+
+static NS_RETURNS_RETAINED NSString *
+_SC_OSStateCopyFormattedString_dnsinfo(uint32_t data_size, void *data)
+{
+ dns_config_t *dns_config = NULL;
+ _dns_config_buf_t *dns_config_buf;
+ NSMutableString *string;
+
+ // os_state_add_handler w/
+ // osd_type = OS_STATE_DATA_CUSTOM
+ // osd_decoder.osdd_library = "SystemConfiguration
+ // osd_decoder.osdd_type = "dnsinfo"
+
+ if ((data_size == 0) || (data == NULL)) {
+ return @"No DNS configuration";
+ } else if (data_size < sizeof(_dns_config_buf_t)) {
+ return SCNSWithFormat(@"DNS configuration: size error (%d < %zd)",
+ data_size,
+ sizeof(_dns_config_buf_t));
+ }
+
+ dns_config_buf = _dns_configuration_buffer_create(data, data_size);
+ if (dns_config_buf == NULL) {
+ return @"DNS configuration: data error";
+ }
+
+ dns_config = _dns_configuration_buffer_expand(dns_config_buf);
+ if (dns_config == NULL) {
+ // if we were unable to expand the configuration
+ _dns_configuration_buffer_free(&dns_config_buf);
+ return @"DNS configuration: expansion error";
+ }
+
+ string = [NSMutableString string];
+ _dns_configuration_log(dns_config, TRUE, string);
+ if (string.length == 0) {
+ [string appendString:@"DNS configuration: not available"];
+ }
+ free(dns_config);
+
+ return string;
+}
+
+static NS_RETURNS_RETAINED NSString *
+_SC_OSStateCopyFormattedString_nwi(uint32_t data_size, void *data)
+{
+ nwi_state_t state = (nwi_state_t)data;
+ NSMutableString *string;
+
+ // os_state_add_handler w/
+ // osd_type = OS_STATE_DATA_CUSTOM
+ // osd_decoder.osdd_library = "SystemConfiguration
+ // osd_decoder.osdd_type = "nwi"
+
+ if ((data_size == 0) || (data == NULL)) {
+ return @"No network information";
+ } else if (data_size < sizeof(nwi_state)) {
+ return SCNSWithFormat(@"Network information: size error (%d < %zd)",
+ data_size,
+ sizeof(_dns_config_buf_t));
+ } else if (state->version != NWI_STATE_VERSION) {
+ return SCNSWithFormat(@"Network information: version error (%d != %d)",
+ state->version,
+ NWI_STATE_VERSION);
+ }
+
+ string = [NSMutableString string];
+ _nwi_state_log(state, TRUE, string);
+ if (string.length == 0) {
+ [string appendString:@"Network information: not available"];
+ }
+
+ return string;
+}
+
+struct SC_OSState_Formatters {
+ const char *type;
+ NS_RETURNS_RETAINED NSString * (*function)(uint32_t data_size, void *data);
+};
+
+NS_RETURNS_RETAINED
+NSString *
+OSStateCreateStringWithData(const char *type, uint32_t data_size, void *data)
+{
+ // add functions for each type into this list
+ static const struct SC_OSState_Formatters formatters[] = {
+ { .type = "dnsinfo", .function = _SC_OSStateCopyFormattedString_dnsinfo },
+ { .type = "nwi", .function = _SC_OSStateCopyFormattedString_nwi },
+ };
+
+ for (int i = 0; i < (int)(sizeof(formatters) / sizeof(formatters[0])); i++) {
+ if (strcmp(type, formatters[i].type) == 0) {
+ return formatters[i].function(data_size, data);
+ }
+ }
+
+ return SCNSWithFormat(@"liblog_SystemConfiguration: Not yet supported os_state formatting type: %s", type);
+}
+
/*
- * Copyright (c) 2011-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2011-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <stdio.h>
#include <sys/socket.h>
#include <dispatch/dispatch.h>
+#ifdef VERBOSE_ACTIVITY_LOGGING
#include <os/activity.h>
+#endif // VERBOSE_ACTIVITY_LOGGING
#include <os/log.h>
#include <xpc/xpc.h>
static libSC_info_client_t *nwi_client = NULL;
+#ifdef VERBOSE_ACTIVITY_LOGGING
static os_activity_t
__nwi_client_activity()
{
return activity;
}
+#endif // VERBOSE_ACTIVITY_LOGGING
static dispatch_queue_t
return NULL;
}
+#ifdef VERBOSE_ACTIVITY_LOGGING
// scope NWI activity
os_activity_scope(__nwi_client_activity());
+#endif // VERBOSE_ACTIVITY_LOGGING
// create message
reqdict = xpc_dictionary_create(NULL, NULL, 0);
_nwi_client_init();
+#ifdef VERBOSE_ACTIVITY_LOGGING
// scope NWI activity
os_activity_scope(__nwi_client_activity());
+#endif // VERBOSE_ACTIVITY_LOGGING
reqdict = xpc_dictionary_create(NULL, NULL, 0);
void
_nwi_state_ack(nwi_state_t state, const char *bundle_id)
{
+#pragma unused(bundle_id)
xpc_object_t reqdict;
if (state == NULL) {
/*
- * Copyright (c) 2011-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2011-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
/*
* Function: nwi_state_copy
* Purpose:
- * Returns the current network state information.
+ * Returns the current network state information; NULL if no state
+ * information is currently available.
* Release after use by calling nwi_state_release().
*/
nwi_state_t
/*
- * Copyright (c) 2012-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2012-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <notify.h>
#include <dispatch/dispatch.h>
#include <xpc/xpc.h>
+#include <os/state_private.h>
#include <CommonCrypto/CommonDigest.h>
#include <CoreFoundation/CoreFoundation.h>
#include <SystemConfiguration/SCPrivate.h>
#pragma mark -
-#pragma mark Network Information server SPIs
+#pragma mark Network information state
+
+
+static void
+add_state_handler()
+{
+#if !TARGET_OS_SIMULATOR
+ os_state_block_t state_block;
+ os_state_handle_t state_handle;
+
+ state_block = ^os_state_data_t(os_state_hints_t hints) {
+#pragma unused(hints)
+ os_state_data_t state_data;
+ size_t state_data_size;
+ CFIndex state_len;
+
+ state_len = (S_nwi_info.data != NULL) ? CFDataGetLength(S_nwi_info.data) : 0;
+ state_data_size = OS_STATE_DATA_SIZE_NEEDED(state_len);
+ if (state_data_size > MAX_STATEDUMP_SIZE) {
+ SC_log(LOG_ERR, "Network information : state data too large (%zd > %zd)",
+ state_data_size,
+ MAX_STATEDUMP_SIZE);
+ return NULL;
+ }
+
+ state_data = calloc(1, state_data_size);
+ if (state_data == NULL) {
+ SC_log(LOG_ERR, "Network information: could not allocate state data");
+ return NULL;
+ }
+
+ state_data->osd_type = OS_STATE_DATA_CUSTOM;
+ state_data->osd_data_size = (uint32_t)state_len;
+ strlcpy(state_data->osd_decoder.osdd_library,
+ "SystemConfiguration",
+ sizeof(state_data->osd_decoder.osdd_library));
+ strlcpy(state_data->osd_decoder.osdd_type,
+ "nwi",
+ sizeof(state_data->osd_decoder.osdd_type));
+ strlcpy(state_data->osd_title, "Network information", sizeof(state_data->osd_title));
+ if (state_len > 0) {
+ memcpy(state_data->osd_data, CFDataGetBytePtr(S_nwi_info.data), state_len);
+ }
+
+ return state_data;
+ };
+
+ state_handle = os_state_add_handler(_nwi_state_server_queue(), state_block);
+ if (state_handle == 0) {
+ SC_log(LOG_ERR, "Network information: os_state_add_handler() failed");
+ }
+#endif // !TARGET_OS_SIMULATOR
+
+
+ return;
+}
+
+
+#pragma mark -
+#pragma mark Network information server SPIs
__private_extern__
load_NetworkInformation(CFBundleRef bundle,
_nwi_sync_handler_t syncHandler)
{
+#pragma unused(bundle)
xpc_connection_t c;
const char *name;
*/
_libSC_info_server_init(&S_nwi_info);
+ /*
+ * add a state dump handler
+ */
+ add_state_handler();
+
/*
* save the in-sync/not-in-sync handler
*/
--- /dev/null
+/*
+ * Copyright (c) 2017 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 _NETWORK_STATE_INFORMATION_LOGGING_H
+#define _NETWORK_STATE_INFORMATION_LOGGING_H
+
+#include <Availability.h>
+#include <TargetConditionals.h>
+#include <sys/cdefs.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCPrivate.h>
+
+#include <network_information.h>
+#include "network_state_information_priv.c"
+
+__BEGIN_DECLS
+
+#ifndef my_log
+#define my_log(__level, __format, ...) SC_log(__level, __format, ## __VA_ARGS__)
+#define MY_LOG_DEFINED_LOCALLY
+#endif // !my_log
+
+#ifndef my_log_context_type
+#define my_log_context_type void *
+#define MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY
+#endif // !my_log_context_type
+
+#ifndef my_log_context_name
+#define my_log_context_name context
+#define MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY
+#endif // !my_log_context_name
+
+#include "SCNetworkReachabilityLogging.h"
+
+/*
+ * _nwi_ifstate_flags_str()
+ *
+ * Returns a string representation of the nwi_state flags.
+ * "(IPv4,IPv6,DNS,...)"
+ */
+static __inline__ void
+_nwi_ifstate_flags_str(nwi_ifstate_flags flags, char *str, size_t len)
+{
+ size_t n;
+ nwi_ifstate_flags remaining;
+
+ assert(len >= sizeof("(0x01234567)")); // check min buffer size
+
+ flags &= NWI_IFSTATE_FLAGS_MASK;
+ if (flags == 0) {
+ str[0] = '\0';
+ return;
+ }
+
+ len--; // leave room for the closing paren
+ n = strlcpy(str, "(", len);
+ remaining = flags;
+
+ if ((remaining & NWI_IFSTATE_FLAGS_HAS_IPV4) &&
+ (n < len) && ((len - n) > sizeof("IPv4,"))) {
+ n = strlcat(str, "IPv4,", len);
+ remaining &= ~NWI_IFSTATE_FLAGS_HAS_IPV4;
+ }
+
+ if ((remaining & NWI_IFSTATE_FLAGS_HAS_IPV6) &&
+ (n < len) && ((len - n) > sizeof("IPv6,"))) {
+ n = strlcat(str, "IPv6,", len);
+ remaining &= ~NWI_IFSTATE_FLAGS_HAS_IPV6;
+ }
+
+ if ((remaining & NWI_IFSTATE_FLAGS_HAS_DNS) &&
+ (n < len) && ((len - n) > sizeof("DNS,"))) {
+ n = strlcat(str, "DNS,", len);
+ remaining &= ~NWI_IFSTATE_FLAGS_HAS_DNS;
+ }
+
+ if ((remaining & NWI_IFSTATE_FLAGS_NOT_IN_LIST) &&
+ (n < len) && ((len - n) > sizeof("NOT-IN-LIST,"))) {
+ n = strlcat(str, "NOT-IN-LIST,", len);
+ remaining &= ~NWI_IFSTATE_FLAGS_NOT_IN_LIST;
+ }
+
+ if ((remaining & NWI_IFSTATE_FLAGS_HAS_SIGNATURE) &&
+ (n < len) && ((len - n) > sizeof("SIGNATURE,"))) {
+ n = strlcat(str, "SIGNATURE,", len);
+ remaining &= ~NWI_IFSTATE_FLAGS_HAS_SIGNATURE;
+ }
+
+ if ((remaining & NWI_IFSTATE_FLAGS_NOT_IN_IFLIST) &&
+ (n < len) && ((len - n) > sizeof("NOT-IN-IFLIST,"))) {
+ n = strlcat(str, "NOT-IN-IFLIST,", len);
+ remaining &= ~NWI_IFSTATE_FLAGS_NOT_IN_IFLIST;
+ }
+
+ if (remaining != 0) {
+ if ((n >= len) ||
+ ((len - n) <= sizeof("0x01234567,"))) {
+ // if we don't have enough space, truncate and start over
+ n = strlcpy(str, "(", len);
+ remaining = flags;
+ }
+
+ n += snprintf(str + n, len - n, ",%p", (void *)remaining);
+ }
+
+ if (n-- > 0) {
+ str[n] = ')'; // trailing "," --> ")"
+ }
+
+ return;
+}
+
+static __inline__ const char *
+_nwi_ifstate_rank_str(Rank rank)
+{
+ const char *str = "???";
+
+ switch (RANK_ASSERTION_MASK(rank)) {
+ case kRankAssertionFirst:
+ str = "First";
+ break;
+ case kRankAssertionDefault:
+ str = "Default";
+ break;
+ case kRankAssertionLast:
+ str = "Last";
+ break;
+ case kRankAssertionNever:
+ str = "Never";
+ break;
+ case kRankAssertionScoped:
+ str = "Scoped";
+ break;
+ default:
+ str = "???";
+ break;
+ }
+
+ return str;
+}
+
+static __inline__ void
+_nwi_ifstate_log(nwi_ifstate_t ifstate, boolean_t debug, my_log_context_type my_log_context_name)
+{
+#if defined(MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY) && defined(MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY)
+#pragma unused(my_log_context_name)
+#endif
+ union {
+ const void *bytes;
+ const struct in_addr *ia;
+ const struct in6_addr *ia6;
+ } addr;
+ char addr_str[INET6_ADDRSTRLEN];
+ nwi_ifstate_flags flags_ifstate;
+ char flags_str[100];
+ const char *if_name;
+ SCNetworkReachabilityFlags reach_flags;
+ char reach_str[100];
+ const struct sockaddr *vpn_addr;
+
+ // nwi_ifstate flags
+ flags_ifstate = nwi_ifstate_get_flags(ifstate);
+ if (debug) {
+ flags_ifstate |= NWI_IFSTATE_FLAGS(ifstate->flags);
+ }
+ flags_ifstate &= ~NWI_IFSTATE_FLAGS_HAS_SIGNATURE; // exclude flag ('cause we'll report the signature only if present)
+ _nwi_ifstate_flags_str(flags_ifstate, flags_str, sizeof(flags_str));
+
+ // if_name
+ if_name = nwi_ifstate_get_ifname(ifstate);
+
+ // reachability flags
+ reach_flags = nwi_ifstate_get_reachability_flags(ifstate);
+
+ // IP address
+ addr.bytes = nwi_ifstate_get_address(ifstate);
+ if (inet_ntop(ifstate->af, addr.bytes, addr_str, sizeof(addr_str)) == NULL) {
+ strlcpy(addr_str, "???", sizeof(addr_str));
+ }
+
+ // verbose format (e.g. scutil)
+ my_log(LOG_INFO, " %7s : flags : %p %s",
+ if_name,
+ (void *)flags_ifstate,
+ flags_str);
+
+ my_log(LOG_INFO, " address : %s", addr_str);
+
+ // VPN server address
+ vpn_addr = nwi_ifstate_get_vpn_server(ifstate);
+ if (vpn_addr != NULL) {
+ char vpn_str[INET6_ADDRSTRLEN];
+
+ _SC_sockaddr_to_string(vpn_addr, vpn_str, sizeof(vpn_str));
+ my_log(LOG_INFO, " VPN server : %s", vpn_str);
+ }
+
+ // reachability
+ __SCNetworkReachability_flags_string(reach_flags, TRUE, reach_str, sizeof(reach_str));
+ my_log(LOG_INFO, " reach : %s", reach_str);
+
+ if (debug) {
+ uint64_t generation;
+ Rank rank;
+ uint32_t rank_index;
+ const char *rank_str;
+ const uint8_t *signature;
+ int signature_length;
+
+ // Rank
+ rank = ifstate->rank;
+ rank_str = _nwi_ifstate_rank_str(rank);
+ rank_index = RANK_INDEX_MASK(rank);
+ if (rank_index != kRankIndexMask) {
+ my_log(LOG_INFO, " rank : 0x%08x (%s, %u)", rank, rank_str, rank_index);
+ } else {
+ my_log(LOG_INFO, " rank : 0x%08x (%s, Last)", rank, rank_str);
+ }
+
+ // signature
+ signature = nwi_ifstate_get_signature(ifstate, AF_UNSPEC, &signature_length);
+ if (signature != NULL) {
+ CFDataRef digest;
+
+ digest = CFDataCreate(NULL, signature, CC_SHA1_DIGEST_LENGTH);
+ my_log(LOG_INFO, " signature : %@", digest);
+ CFRelease(digest);
+ }
+
+ // generation
+ generation = nwi_ifstate_get_generation(ifstate);
+ my_log(LOG_INFO, " generation : %llu", generation);
+ }
+
+ return;
+}
+
+static __inline__ void
+_nwi_state_reachability_log(nwi_state_t state, boolean_t debug, int af, my_log_context_type my_log_context_name)
+{
+#if defined(MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY) && defined(MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY)
+#pragma unused(my_log_context_name)
+#endif
+ uint32_t flags;
+ char flags_str[100];
+
+ flags = nwi_state_get_reachability_flags(state, af);
+ __SCNetworkReachability_flags_string(flags, TRUE, flags_str, sizeof(flags_str));
+ if (!debug) {
+ my_log(LOG_INFO, "%s", "");
+ }
+ my_log(LOG_INFO, " REACH : flags %s", flags_str);
+
+ return;
+}
+
+static __inline__ void
+_nwi_state_log(nwi_state_t state, boolean_t debug, my_log_context_type my_log_context_name)
+{
+#if defined(MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY) && defined(MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY)
+#pragma unused(my_log_context_name)
+#endif
+ unsigned int count;
+ nwi_ifindex_t i;
+ nwi_ifstate_t ifstate;
+
+ if (!debug) {
+ my_log(LOG_INFO, "%s", "Network information");
+ } else {
+ my_log(LOG_INFO,
+ "Network information (generation %llu size=%lu)",
+ nwi_state_get_generation(state),
+ nwi_state_size(state));
+ }
+
+ // report IPv4 state
+ if (!debug) {
+ // show regular interfaces
+ my_log(LOG_INFO, "%s", "");
+ my_log(LOG_INFO, "%s", "IPv4 network interface information");
+ ifstate = nwi_state_get_first_ifstate(state, AF_INET);
+ if (ifstate == NULL) {
+ my_log(LOG_INFO, "%s", " No IPv4 states found");
+ } else {
+ while (ifstate != NULL) {
+ _nwi_ifstate_log(ifstate, debug, my_log_context_name);
+ ifstate = nwi_ifstate_get_next(ifstate, AF_INET);
+ }
+ }
+ } else {
+ my_log(LOG_INFO, "%s", "IPv4 network interface information");
+ if (state->ipv4_count > 0) {
+ // show ALL interfaces
+ for (i = 0, ifstate = nwi_state_ifstate_list(state, AF_INET);
+ i < state->ipv4_count; i++, ifstate++) {
+ _nwi_ifstate_log(ifstate, debug, my_log_context_name);
+ }
+ } else {
+ my_log(LOG_INFO, "%s", " No IPv4 states found");
+ }
+ }
+ _nwi_state_reachability_log(state, debug, AF_INET, my_log_context_name);
+
+ // report IPv6 state
+ if (!debug) {
+ // show regular interfaces
+ my_log(LOG_INFO, "%s", "");
+ my_log(LOG_INFO, "%s", "IPv6 network interface information");
+ ifstate = nwi_state_get_first_ifstate(state, AF_INET6);
+ if (ifstate == NULL) {
+ my_log(LOG_INFO, "%s", " No IPv6 states found\n");
+ } else {
+ while (ifstate != NULL) {
+ _nwi_ifstate_log(ifstate, debug, my_log_context_name);
+ ifstate = nwi_ifstate_get_next(ifstate, AF_INET6);
+ }
+ }
+ } else {
+ my_log(LOG_INFO, "%s", "IPv6 network interface information");
+ if (state->ipv6_count > 0) {
+ // show ALL interfaces
+ for (i = 0, ifstate = nwi_state_ifstate_list(state, AF_INET6);
+ i < state->ipv6_count; i++, ifstate++) {
+ _nwi_ifstate_log(ifstate, debug, my_log_context_name);
+ }
+ } else {
+ my_log(LOG_INFO, "%s", " No IPv6 states found\n");
+ }
+ }
+ _nwi_state_reachability_log(state, debug, AF_INET6, my_log_context_name);
+
+ count = nwi_state_get_interface_names(state, NULL, 0);
+ if (count > 0) {
+ const char *names[count];
+
+ count = nwi_state_get_interface_names(state, names, count);
+ if (count > 0) {
+ char str[count * (IFNAMSIZ + 1)];
+
+ memset(str, 0, sizeof(str));
+ for (unsigned int i = 0; i < count; i++) {
+ if (i != 0) {
+ strlcat(str, " ", sizeof(str));
+ }
+ strlcat(str, names[i], sizeof(str));
+ }
+
+ if (!debug) {
+ my_log(LOG_INFO, "%s", "");
+ }
+ my_log(LOG_INFO, "Network interfaces: %s", str);
+ }
+ }
+
+ return;
+}
+
+#ifdef MY_LOG_DEFINED_LOCALLY
+#undef my_log
+#undef MY_LOG_DEFINED_LOCALLY
+#endif // MY_LOG_DEFINED_LOCALLY
+
+#ifdef MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY
+#undef my_log_context_type
+#undef MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY
+#endif // MY_LOG_CONTEXT_TYPE_DEFINED_LOCALLY
+
+#ifdef MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY
+#undef my_log_context_name
+#undef MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY
+#endif // MY_LOG_CONTEXT_NAME_DEFINED_LOCALLY
+
+__END_DECLS
+
+#endif // _NETWORK_STATE_INFORMATION_LOGGING_H
/*
- * Copyright (c) 2011-2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2011-2015, 2017 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,
* 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@
*/
for (i = 0, scan = nwi_state_if_list(state);
i < state->if_list_count;
i++, scan++) {
- nwi_ifstate_t this;
-
- this = state->ifstate_list + *scan;
- if (strcmp(this->ifname, ifstate->ifname) == 0) {
+ nwi_ifstate_t this_ifstate;
+
+ this_ifstate = state->ifstate_list + *scan;
+ if (strcmp(this_ifstate->ifname, ifstate->ifname) == 0) {
/* it's already in the list */
return;
}
nwi_ifstate_t scan_v6;
int v4;
int v6;
-
+
v4 = 0;
v6 = 0;
state->if_list_count = 0;
scan_v4 = nwi_state_get_ifstate_with_index(state, AF_INET, v4);
scan_v6 = nwi_state_get_ifstate_with_index(state, AF_INET6, v6);
while (scan_v4 != NULL || scan_v6 != NULL) {
- bool add_v4 = FALSE;
-
+ boolean_t add_v4 = FALSE;
+
if (scan_v4 != NULL && scan_v6 != NULL) {
/* add the higher rank of v4 or v6 */
if (scan_v4->rank <= scan_v6->rank) {
return dest;
}
size = nwi_state_size(src);
- dest = malloc(size);
+ dest = (nwi_state_t)malloc(size);
if (dest != NULL) {
bcopy(src, dest, size);
}
}
size = nwi_state_compute_size(max_if_count);
- state = malloc(size);
+ state = (nwi_state_t)malloc(size);
bzero(state, size);
state->max_if_count = max_if_count;
state->version = NWI_STATE_VERSION;
{
nwi_ifstate_t alias;
- alias = nwi_state_get_ifstate_with_name(state,
+ alias = nwi_state_get_ifstate_with_name(state,
nwi_other_af(ifstate->af),
ifstate->ifname);
if (alias == NULL) {
/* this is the new last ifstate */
ifstate->flags |= NWI_IFSTATE_FLAGS_LAST_ITEM;
(*count_p)++;
-
+
/* add the alias */
nwi_state_add_ifstate_alias(state, ifstate);
}
static inline nwi_ifstate_t
nwi_state_diff_append(nwi_state_t state, nwi_ifstate_t scan)
{
- nwi_ifstate_t new_ifstate = NULL;
nwi_ifindex_t * last;
+ nwi_ifstate_t new_ifstate = NULL;
new_ifstate = nwi_state_get_last_ifstate(state, scan->af, &last);
memcpy(new_ifstate, scan, sizeof(*scan));
}
static void
-nwi_state_diff_add_change(nwi_state_t diff, nwi_state_t old,
+nwi_state_diff_add_change(nwi_state_t diff, nwi_state_t old_ifstate,
nwi_ifstate_t ifstate)
{
nwi_ifstate_t existing;
- nwi_ifstate_t new;
+ nwi_ifstate_t new_ifstate;
- existing = nwi_state_get_ifstate_with_name(old,
+ existing = nwi_state_get_ifstate_with_name(old_ifstate,
ifstate->af,
nwi_ifstate_get_ifname(ifstate));
- new = nwi_state_diff_append(diff, ifstate);
+ new_ifstate = nwi_state_diff_append(diff, ifstate);
if (existing != NULL) {
- if (nwi_ifstate_has_changed(existing, new)) {
- nwi_ifstate_set_diff(new,
+ if (nwi_ifstate_has_changed(existing, new_ifstate)) {
+ nwi_ifstate_set_diff(new_ifstate,
NWI_IFSTATE_DIFF_CHANGED);
- } else if (existing->rank < new->rank) {
- nwi_ifstate_set_diff(new,
+ } else if (existing->rank < new_ifstate->rank) {
+ nwi_ifstate_set_diff(new_ifstate,
NWI_IFSTATE_DIFF_RANK_DOWN);
- } else if (existing->rank > new->rank) {
- nwi_ifstate_set_diff(new,
+ } else if (existing->rank > new_ifstate->rank) {
+ nwi_ifstate_set_diff(new_ifstate,
NWI_IFSTATE_DIFF_RANK_UP);
} else {
- nwi_ifstate_set_diff(new,
+ nwi_ifstate_set_diff(new_ifstate,
NWI_IFSTATE_DIFF_UNCHANGED);
}
} else {
- nwi_ifstate_set_diff(new, NWI_IFSTATE_DIFF_ADDED);
+ nwi_ifstate_set_diff(new_ifstate, NWI_IFSTATE_DIFF_ADDED);
}
return;
}
}
static void
-nwi_state_diff_populate(nwi_state_t diff, nwi_state_t old, nwi_state_t new)
+nwi_state_diff_populate(nwi_state_t diff, nwi_state_t old_ifstate, nwi_state_t new_ifstate)
{
int i;
nwi_ifstate_t scan;
- if (new != NULL) {
+ if (new_ifstate != NULL) {
/* check for adds/changes */
- if (new->ipv4_count) {
- for (i = 0, scan = new->ifstate_list;
- i < new->ipv4_count; i++, scan++) {
- nwi_state_diff_add_change(diff, old, scan);
+ if (new_ifstate->ipv4_count) {
+ for (i = 0, scan = new_ifstate->ifstate_list;
+ i < new_ifstate->ipv4_count; i++, scan++) {
+ nwi_state_diff_add_change(diff, old_ifstate, scan);
}
}
- if (new->ipv6_count) {
- scan = new->ifstate_list + new->max_if_count;
+ if (new_ifstate->ipv6_count) {
+ scan = new_ifstate->ifstate_list + new_ifstate->max_if_count;
for (i = 0;
- i < new->ipv6_count; i++, scan++) {
- nwi_state_diff_add_change(diff, old, scan);
+ i < new_ifstate->ipv6_count; i++, scan++) {
+ nwi_state_diff_add_change(diff, old_ifstate, scan);
}
}
}
- if (old != NULL) {
+ if (old_ifstate != NULL) {
/* check for removes */
- if (old->ipv4_count) {
- for (i = 0, scan = old->ifstate_list;
- i < old->ipv4_count; i++, scan++) {
+ if (old_ifstate->ipv4_count) {
+ for (i = 0, scan = old_ifstate->ifstate_list;
+ i < old_ifstate->ipv4_count; i++, scan++) {
nwi_state_diff_remove(diff, scan);
}
}
- if (old->ipv6_count) {
- scan = old->ifstate_list + old->max_if_count;
+ if (old_ifstate->ipv6_count) {
+ scan = old_ifstate->ifstate_list + old_ifstate->max_if_count;
for (i = 0;
- i < old->ipv6_count; i++, scan++) {
+ i < old_ifstate->ipv6_count; i++, scan++) {
nwi_state_diff_remove(diff, scan);
}
}
}
__private_extern__ nwi_state_t
-nwi_state_diff(nwi_state_t old, nwi_state_t new)
+nwi_state_diff(nwi_state_t old_ifstate, nwi_state_t new_ifstate)
{
nwi_state_t diff;
int total_count = 0;
* Worst case assumes that the old and new share none of the
* same interfaces.
*/
- if (old != NULL) {
- total_count += nwi_state_max_af_count(old);
+ if (old_ifstate != NULL) {
+ total_count += nwi_state_max_af_count(old_ifstate);
}
- if (new != NULL) {
- total_count += nwi_state_max_af_count(new);
+ if (new_ifstate != NULL) {
+ total_count += nwi_state_max_af_count(new_ifstate);
}
if (total_count == 0) {
return NULL;
}
diff = nwi_state_new(NULL, total_count);
- nwi_state_diff_populate(diff, old, new);
+ nwi_state_diff_populate(diff, old_ifstate, new_ifstate);
/* diff consists of a nwi_state_t with diff flags on each ifstate */
return diff;
_nwi_ifstate_set_generation(scan, generation_count);
} else {
nwi_ifstate_t old_ifstate;
-
+
old_ifstate = nwi_state_get_ifstate_with_name(old_state,
AF_INET,
scan->ifname);
assert(old_ifstate != NULL);
-
+
/* Set the current generation count */
_nwi_ifstate_set_generation(scan,
old_ifstate->if_generation_count);
_nwi_ifstate_set_generation(scan, generation_count);
} else {
nwi_ifstate_t old_ifstate;
-
+
old_ifstate = nwi_state_get_ifstate_with_name(old_state,
AF_INET6,
scan->ifname);
assert(old_ifstate != NULL);
-
+
/* Set the current generation count */
_nwi_ifstate_set_generation(scan,
old_ifstate->if_generation_count);
/*
- * Copyright (c) 2011-2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2011-2013, 2016, 2017 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,
* 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 "network_information.h"
+#define NWI_STATE_VERSION ((uint32_t)0x20170601)
+
+
#define NWI_IFSTATE_FLAGS_NOT_IN_LIST 0x0008
#define NWI_IFSTATE_FLAGS_HAS_SIGNATURE 0x0010
#define NWI_IFSTATE_FLAGS_NOT_IN_IFLIST 0x0020
/*
* NWI_IFSTATE_FLAGS_MASK
- * - these are the bits that get preserved, all others are
+ * - these are the bits that get preserved, all others are
* control (last item, diff)
*/
#define NWI_IFSTATE_FLAGS_MASK 0x00ff
} nwi_ifstate_difference_t;
+/*
+ * Type: Rank
+ * Purpose:
+ * A 32-bit value to encode the relative rank of a service.
+ *
+ * The top 8 bits are used to hold the rank assertion (first, default, last,
+ * never, scoped);
+ *
+ * The bottom 24 bits are used to store the service index (i.e. the
+ * position within the service order array).
+ */
typedef uint32_t Rank;
+#define RANK_ASSERTION_MAKE(r) ((Rank)(r) << 24) // rank assertion (top 8 bits)
+#define kRankAssertionFirst RANK_ASSERTION_MAKE(0)
+#define kRankAssertionDefault RANK_ASSERTION_MAKE(1)
+#define kRankAssertionLast RANK_ASSERTION_MAKE(2)
+#define kRankAssertionNever RANK_ASSERTION_MAKE(3)
+#define kRankAssertionScoped RANK_ASSERTION_MAKE(4)
+#define kRankAssertionMask RANK_ASSERTION_MAKE(0xff)
+#define RANK_ASSERTION_MASK(r) ((Rank)(r) & kRankAssertionMask)
+#define RANK_INDEX_MAKE(r) ((Rank)(r)) // rank index (bottom 24 bits)
+#define kRankIndexMask RANK_INDEX_MAKE(0xffffff)
+#define RANK_INDEX_MASK(r) ((Rank)(r) & kRankIndexMask)
+
typedef int32_t nwi_ifindex_t;
#pragma pack(4)
} nwi_ifstate;
#pragma pack()
-#define NWI_STATE_VERSION ((uint32_t)0x20150214)
-
#pragma pack(4)
typedef struct _nwi_state {
uint32_t version; /* NWI_STATE_VERSION */
/*
- * Copyright (c) 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
SET_PROXY_CONFIG(SOCKS);
if ([proxyConfig count] > 0) {
- NSString *matchDomain = self.options[kSCTestConfigAgentProxyMatchDomain] ? self.options[kSCTestConfigAgentProxyMatchDomain] : @TEST_DOMAIN;
- [proxyConfig setObject:@[matchDomain] forKey:(__bridge NSString *)kSCPropNetProxiesSupplementalMatchDomains];
+
+ NSArray<NSString *> *domains = nil;
+ NSString *matchDomains = self.options[kSCTestConfigAgentProxyMatchDomain];
+ if (matchDomains == nil) {
+ domains = @[@TEST_DOMAIN];
+ } else {
+ domains = [matchDomains componentsSeparatedByString:@","];
+ }
+
+ [proxyConfig setObject:domains forKey:(__bridge NSString *)kSCPropNetProxiesSupplementalMatchDomains];
} else {
proxyConfig = nil;
}
change:(NSDictionary *)change
context:(void *)context
{
+#pragma unused(change)
+#pragma unused(context)
NWPathEvaluator *pathEvaluator = (NWPathEvaluator *)object;
if ([keyPath isEqualToString:@"path"]) {
self.pathProxy = pathEvaluator.path.proxySettings;
/*
- * Copyright (c) 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
void
myTestCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *ctx)
{
+#pragma unused(store)
+#pragma unused(changedKeys)
SCTestDynamicStore *test = (__bridge SCTestDynamicStore *)ctx;
test.counter++;
if (test.sem != NULL) {
"-gopher_proxy : Add a proxy agent with Gopher proxy. Format of the argument is 'server:port'\n"\
"-http_proxy : Add a proxy agent with HTTP proxy. Format of the argument is 'server:port'\n"\
"-https_proxy : Add a proxy agent with HTTPS proxy. Format of the argument is 'server:port'\n"\
- "-proxy_match_domain : Add a proxy agent for a match domain. If this option is not specified, 'apple.com' will be used\n"\
+ "-proxy_match_domain : Configures the Proxy server for certain domains. A comma-separated list of domains can be specified. Default is 'apple.com'\n"\
"-remove_proxy : Remove a proxy configuration, previously configured via 'sctest'\n"\
"-socks_proxy : Add a proxy agent with SOCKS proxy. Format of the argument is 'server:port'\n"\
"\n============== reachability options =============\n"\
/*
- * Copyright (c) 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
- (BOOL)unitTestNetworkServicesSanity
{
// We verify that every service has a unique name, an interface, an IPv4 config method and and IPv6 config method.
+ NSArray *sets;
NSDictionary *services;
- NSMutableArray *serviceNameArray;
SCTestPreferences *test;
test = [[SCTestPreferences alloc] initWithOptions:self.options];
+
+ sets = (__bridge_transfer NSArray *)SCNetworkSetCopyAll(test.prefs);
+ if (sets == nil || [sets count] == 0) {
+ SCTestLog("No sets present!");
+ return NO;
+ }
+
services = (__bridge NSDictionary *)SCPreferencesGetValue(test.prefs, kSCPrefNetworkServices);
- if (services == NULL) {
+ if (services == nil || [services count] == 0) {
SCTestLog("No services present!");
return NO;
}
- serviceNameArray = [[NSMutableArray alloc] init];
- for (NSString *serviceID in services) {
- NSDictionary *serviceDict;
- NSString *serviceName;
- NSDictionary *interfaceDict;
- NSString *interfaceType;
- NSDictionary *ipv4Dict;
- NSDictionary *ipv6Dict;
-
- serviceDict = [services objectForKey:serviceID];
- if (![serviceDict isKindOfClass:[NSDictionary class]]) {
- SCTestLog("Service is not a dictionary");
- return NO;
+ for (id setPtr in sets) {
+ SCNetworkSetRef set = (__bridge SCNetworkSetRef)setPtr;
+ NSArray *serviceArray = nil;
+ NSMutableArray *serviceNameArray = nil;
+ NSString *setID;
+
+ setID = (__bridge NSString *)SCNetworkSetGetSetID(set);
+
+ serviceArray = (__bridge_transfer NSArray *)SCNetworkSetCopyServices(set);
+ if (serviceArray == nil) {
+ SCTestLog("No services in set %@!", setID);
+ continue;
}
- serviceName = [serviceDict objectForKey:(__bridge NSString *)kSCPropNetServiceUserDefinedName];
- if (serviceName != nil) {
- // Check if the name is unique
- BOOL namePresent = [serviceNameArray containsObject:serviceName];
- if (!namePresent) {
- [serviceNameArray addObject:serviceName];
+ serviceNameArray = [[NSMutableArray alloc] init];
+ for (id servicePTR in serviceArray) {
+ NSDictionary *serviceDict;
+ NSDictionary *ipv4Dict;
+ NSDictionary *ipv6Dict;
+ NSDictionary *ipv4ProtocolConfig;
+ NSDictionary *ipv6ProtocolConfig;
+ NSString *serviceName;
+ NSString *serviceID;
+ NSString *interfaceType;
+ SCNetworkServiceRef service;
+ SCNetworkInterfaceRef interface;
+ SCNetworkProtocolRef ipv4Protocol;
+ SCNetworkProtocolRef ipv6Protocol;
+
+
+ service = (__bridge SCNetworkServiceRef)servicePTR;
+ serviceID = (__bridge NSString *)SCNetworkServiceGetServiceID(service);
+
+ serviceDict = [services objectForKey:serviceID];
+ if (![serviceDict isKindOfClass:[NSDictionary class]]) {
+ SCTestLog("Service is not a dictionary");
+ return NO;
+ }
+
+ serviceName = (__bridge NSString *)SCNetworkServiceGetName(service);
+ if (serviceName != nil) {
+ // Check if the name is unique
+ BOOL namePresent = [serviceNameArray containsObject:serviceName];
+ if (!namePresent) {
+ [serviceNameArray addObject:serviceName];
+ } else {
+ SCTestLog("Duplicate services with name %@ exist", serviceName);
+ return NO;
+ }
} else {
- SCTestLog("Duplicate services with name %@ exist", serviceName);
+ SCTestLog("Service ID %@ does not have a name", serviceID);
return NO;
}
- } else {
- SCTestLog("Service ID %@ does not have a name", serviceID);
- return NO;
- }
- interfaceDict = [serviceDict objectForKey:(__bridge NSString *)kSCCompInterface];
- if (interfaceDict == nil) {
- SCTestLog("Service %@ does not have an interface", serviceName);
- return NO;
- }
+ interface = SCNetworkServiceGetInterface(service);
+ if (interface == nil) {
+ SCTestLog("Service %@ does not have an interface", serviceName);
+ return NO;
+ }
- interfaceType = [interfaceDict objectForKey:(__bridge NSString *)kSCPropNetInterfaceType];
- if (interfaceType != nil && [interfaceType containsString:@"CommCenter"]) {
- // CommCenter services typically do not have an ipv4/v6 data OR config method. Skip such services.
- continue;
- }
+ interfaceType = (__bridge NSString *)SCNetworkInterfaceGetInterfaceType(interface);
+ if (interfaceType == nil || [interfaceType length] == 0) {
+ SCTestLog("Service %@ does not have an interface type", serviceName);
+ return NO;
+ }
+#if TARGET_OS_IPHONE
+ if ([interfaceType containsString:@"CommCenter"]) {
+ // CommCenter services typically do not have an ipv4/v6 data OR config method. Skip such services.
+ continue;
+ }
+#endif // TARGET_OS_IPHONE
+ ipv4Protocol = SCNetworkServiceCopyProtocol(service, kSCNetworkProtocolTypeIPv4);
+ ipv6Protocol = SCNetworkServiceCopyProtocol(service, kSCNetworkProtocolTypeIPv6);
+
+ if (ipv4Protocol != NULL) {
+ ipv4ProtocolConfig = (__bridge NSDictionary *)SCNetworkProtocolGetConfiguration(ipv4Protocol);
+ if (ipv4ProtocolConfig != nil) {
+ ipv4Dict = [ipv4ProtocolConfig copy];
+ }
+ CFRelease(ipv4Protocol);
+ }
- ipv4Dict = [serviceDict objectForKey:(__bridge NSString *)kSCEntNetIPv4];
- ipv6Dict = [serviceDict objectForKey:(__bridge NSString *)kSCEntNetIPv6];
+ if (ipv6Protocol != NULL) {
+ ipv6ProtocolConfig = (__bridge NSDictionary *)SCNetworkProtocolGetConfiguration(ipv6Protocol);
+ if (ipv6ProtocolConfig != nil) {
+ ipv6Dict = [ipv6ProtocolConfig copy];
+ }
+ CFRelease(ipv6Protocol);
+ }
- // Check that we have at least one IP config method
- if (ipv4Dict == nil && ipv6Dict == nil) {
- SCTestLog("Service %@ does not have an IP dictionary", serviceName);
- return NO;
- }
+ // Check that we have at least one IP config method
+ if (ipv4Dict == nil && ipv6Dict == nil) {
+ SCTestLog("Service %@ does not have an IP dictionary", serviceName);
+ return NO;
+ }
- if ([ipv4Dict objectForKey:(__bridge NSString *)kSCPropNetIPv4ConfigMethod] == nil &&
- [ipv6Dict objectForKey:(__bridge NSString *)kSCPropNetIPv6ConfigMethod] == nil) {
- SCTestLog("Service %@ does not have an IP Config Method", serviceName);
- return NO;
+ if ([ipv4Dict objectForKey:(__bridge NSString *)kSCPropNetIPv4ConfigMethod] == nil &&
+ [ipv6Dict objectForKey:(__bridge NSString *)kSCPropNetIPv6ConfigMethod] == nil) {
+ SCTestLog("Service %@ does not have an IP Config Method", serviceName);
+ return NO;
+ }
}
}
- (BOOL)unitTestPreferencesAPI
{
BOOL ok = NO;
- int iterations = 1000;
+ int iterations = 100;
NSDictionary *prefsOptions;
NSMutableArray *keys;
NSMutableArray *values;
/*
- * Copyright (c) 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
}
void
-myReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info)
+myReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info)
{
+#pragma unused(target)
+#pragma unused(info)
struct tm tm_now;
struct timeval tv_now;
(void)gettimeofday(&tv_now, NULL);
/*
- * Copyright (c) 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
{"config_agent", "gopher_proxy", "kSCTestConfigAgentGopherProxy", required_argument, "Add a proxy agent with Gopher proxy. Format of the argument is 'server:port'"},
{"config_agent", "http_proxy", "kSCTestConfigAgentHTTPProxy", required_argument, "Add a proxy agent with HTTP proxy. Format of the argument is 'server:port'"},
{"config_agent", "https_proxy", "kSCTestConfigAgentHTTPSProxy", required_argument, "Add a proxy agent with HTTPS proxy. Format of the argument is 'server:port'"},
- {"config_agent", "proxy_match_domain", "kSCTestConfigAgentProxyMatchDomain", required_argument, "Add a proxy agent for a match domain. If this option is not specified, 'apple.com' will be used"},
+ {"config_agent", "proxy_match_domain", "kSCTestConfigAgentProxyMatchDomain", required_argument, "Configures the Proxy server for certain domains. A comma-separated list of domains can be specified. Default is 'apple.com'"},
{"config_agent", "remove_proxy", "kSCTestConfigAgentRemoveProxy", no_argument, "Remove a proxy configuration, previously configured via 'sctest'"},
{"config_agent", "socks_proxy", "kSCTestConfigAgentSOCKSProxy", required_argument, "Add a proxy agent with SOCKS proxy. Format of the argument is 'server:port'"},
/*
- * Copyright (c) 2000-2005, 2011 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2011, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static void
cache_SCDynamicStoreSetValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListRef value)
{
+#pragma unused (store)
CFIndex i;
i = CFArrayGetFirstIndexOfValue(cached_removals,
static void
cache_SCDynamicStoreRemoveValue(SCDynamicStoreRef store, CFStringRef key)
{
+#pragma unused (store)
CFDictionaryRemoveValue(cached_set, key);
if (!CFArrayContainsValue(cached_removals,
static void
cache_SCDynamicStoreNotifyValue(SCDynamicStoreRef store, CFStringRef key)
{
+#pragma unused (store)
if (!CFArrayContainsValue(cached_notifys,
CFRangeMake(0, CFArrayGetCount(cached_notifys)),
key)) {
static CFComparisonResult
-sort_keys(const void *p1, const void *p2, void *context) {
+sort_keys(const void *p1, const void *p2, void *context)
+{
+#pragma unused(context)
CFStringRef key1 = (CFStringRef)p1;
CFStringRef key2 = (CFStringRef)p2;
return CFStringCompare(key1, key2, 0);
void
do_get(int argc, char **argv)
{
+#pragma unused(argc)
CFStringRef key;
CFPropertyListRef newValue;
void
do_set(int argc, char **argv)
{
+#pragma unused(argc)
CFStringRef key;
key = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
void
do_remove(int argc, char **argv)
{
+#pragma unused(argc)
CFStringRef key;
key = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
void
do_notify(int argc, char **argv)
{
+#pragma unused(argc)
CFStringRef key;
key = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
/*
- * Copyright (c) 2000-2011, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2011, 2013, 2014, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
{ "n.cancel", 0, 1, do_notify_cancel, 5, 0,
" n.cancel : cancel notification requests" },
- { "snapshot", 0, 0, do_snapshot, 99, 2,
- " snapshot : save snapshot of store and session data" }
+ { "snapshot", 0, 1, do_snapshot, 99, 2,
+ " snapshot [file] : save snapshot of store and session data" }
};
__private_extern__
const int nCommands_store = (sizeof(commands_store)/sizeof(cmdInfo));
void
do_help(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
int g = -1; /* current group */
int i;
void
do_readFile(int argc, char **argv)
{
+#pragma unused(argc)
InputRef src;
/* allocate command input stream */
void
do_quit(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
termRequested = TRUE;
return;
}
/*
- * Copyright (c) 2000-2005, 2009-2011, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009-2011, 2013, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
void
do_dictInit(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (value != NULL) {
CFRelease(value);
}
void
do_dictShow(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (value == NULL) {
SCPrint(TRUE, stdout, CFSTR("d.show: dictionary must be initialized.\n"));
return;
void
do_dictRemoveKey(int argc, char **argv)
{
+#pragma unused(argc)
CFStringRef key;
CFMutableDictionaryRef val;
/*
- * Copyright (c) 2010-2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2010-2015, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static void
nc_ondemand_callback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
{
+#pragma unused(info)
CFStringRef key = NULL;
CFDictionaryRef ondemand_dict = NULL;
struct tm tm_now;
static void
nc_list(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
CFIndex count;
CFIndex i;
CFArrayRef services = NULL;
static void
nc_help(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
SCPrint(TRUE, stderr, CFSTR("Valid commands for scutil --nc (VPN connections)\n"));
SCPrint(TRUE, stderr, CFSTR("Usage: scutil --nc [command]\n"));
SCPrint(TRUE, stderr, CFSTR("\n"));
/*
- * Copyright (c) 2004-2007, 2009-2011, 2014, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2007, 2009-2011, 2014, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
return FALSE;
}
- CFDictionarySetValue(newConfiguration,
- *(options[optionIndex].key),
- *(choices[i].key));
+ if (choices[i].key != NULL) {
+ CFDictionarySetValue(newConfiguration,
+ *(options[optionIndex].key),
+ *(choices[i].key));
+ } else {
+ CFDictionaryRemoveValue(newConfiguration,
+ *(options[optionIndex].key));
+ }
} else {
SCPrint(TRUE, stdout,
CFSTR("invalid %s\n"),
void
do_net_commit(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (!SCPreferencesCommitChanges(prefs)) {
SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
return;
void
do_net_apply(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (!SCPreferencesApplyChanges(prefs)) {
SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
}
static void
do_net_migrate_validate(int argc, char **argv)
{
+#pragma unused(argc)
char *configuration = NULL;
CFURLRef configurationURL = NULL;
char *expectedConfiguration = NULL;
argv++;
argc--;
- if (strncmp(key, "perform", strlen(key)) == 0) {
+ if (strcmp(key, "perform") == 0) {
do_net_migrate_perform(argc, argv);
- }
- else if (strncmp(key, "validate", strlen(key)) == 0) {
+ } else if (strcmp(key, "validate") == 0) {
do_net_migrate_validate(argc, argv);
- }
- else {
+ } else {
SCPrint(TRUE, stderr, CFSTR("migrate what?\n"));
return;
}
void
do_net_update(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
SCNetworkSetRef set;
Boolean setCreated = FALSE;
Boolean setUpdated = FALSE;
void
do_net_snapshot(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (prefs == NULL) {
SCPrint(TRUE, stdout, CFSTR("network configuration not open\n"));
return;
/*
- * Copyright (c) 2004-2011, 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2011, 2013-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
selected = _SCNetworkInterfaceCreateWithBSDName(NULL, select_name, kIncludeNoVirtualInterfaces);
if (selected != NULL) {
- goto done;
+ if (_SCNetworkInterfaceGetIOPath(selected) != NULL) {
+ // if [real] interface exists
+ goto done;
+ }
+
+ CFRelease(selected);
+ selected = NULL;
}
// try to select the interface by its interface type
void
show_interfaces(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
CFIndex i;
CFIndex n;
static int
__doRank(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(key)
+#pragma unused(info)
+#pragma unused(newConfiguration)
SCNetworkInterfaceRef interface;
CFStringRef interfaceName;
Boolean ok = FALSE;
static int
__doQoSMarking(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(key)
+#pragma unused(description)
+#pragma unused(info)
+#pragma unused(newConfiguration)
CFStringRef interfaceName;
CFMutableDictionaryRef newPolicy;
Boolean ok;
static int
__doCapability(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(info)
Boolean ok = FALSE;
if (argc < 1) {
static int
__doIPSecSharedSecret(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
CFStringRef encryptionType;
if (argc < 1) {
static int
__doIPSecSharedSecretType(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
if (argc < 1) {
SCPrint(TRUE, stdout, CFSTR("IPSec shared secret type mode not specified\n"));
return -1;
static int
__doIPSecXAuthPassword(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
CFStringRef encryptionType;
if (argc < 1) {
static int
__doIPSecXAuthPasswordType(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
if (argc < 1) {
SCPrint(TRUE, stdout, CFSTR("IPSec XAuth password type mode not specified\n"));
return -1;
static int
__doOnDemandDomains(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
CFMutableArrayRef domains;
if (argc < 1) {
static int
__doIPSecOnDemandMatch(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(key)
+#pragma unused(description)
+#pragma unused(info)
Boolean ok;
if (argc < 1) {
static int
__doPPPAuthPW(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
CFStringRef encryptionType;
if (argc < 1) {
static int
__doPPPAuthPWType(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
if (argc < 1) {
SCPrint(TRUE, stdout, CFSTR("PPP password type mode not specified\n"));
return -1;
static int
__doPPPIPSec(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newPPPConfiguration)
{
+#pragma unused(key)
+#pragma unused(description)
+#pragma unused(info)
+#pragma unused(newPPPConfiguration)
SCNetworkInterfaceRef childInterface;
CFStringRef childInterfaceType;
CFDictionaryRef configuration;
static Boolean
set_interface_vlan(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(argc)
+#pragma unused(argv)
+#pragma unused(newConfiguration)
// xxxxx ("device", "tag")
SCPrint(TRUE, stdout, CFSTR("vlan interface management not yet supported\n"));
return FALSE;
static int
__doVPNAuthPW(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
CFStringRef encryptionType;
if (argc < 1) {
static int
__doVPNAuthPWType(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
if (argc < 1) {
SCPrint(TRUE, stdout, CFSTR("VPN password type mode not specified\n"));
return -1;
/*
- * Copyright (c) 2004-2009, 2011, 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2009, 2011, 2014, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
/* -------------------- */
-__private_extern__
-CFComparisonResult
-_compare_protocols(const void *val1, const void *val2, void *context)
-{
- SCNetworkProtocolRef p1 = (SCNetworkProtocolRef)val1;
- SCNetworkProtocolRef p2 = (SCNetworkProtocolRef)val2;
- CFStringRef type1;
- CFStringRef type2;
-
- type1 = SCNetworkProtocolGetProtocolType(p1);
- type2 = SCNetworkProtocolGetProtocolType(p2);
-
- return CFStringCompare(type1, type2, 0);
-}
-
-
static CFStringRef
__copyIPv4Address(const char *arg)
{
sorted = CFArrayCreateMutableCopy(NULL, 0, protocols);
CFArraySortValues(sorted,
CFRangeMake(0, n),
- _compare_protocols,
+ _SCNetworkProtocolCompare,
NULL);
CFRelease(protocols);
protocols = sorted;
void
select_protocol(int argc, char **argv)
{
+#pragma unused(argc)
SCNetworkProtocolRef protocol;
protocol = _find_protocol(argv[0]);
static int
__doDNSDomain(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
if (argc < 1) {
SCPrint(TRUE, stdout, CFSTR("DNS domain name not specified\n"));
return -1;
static int
__doDNSDomainArray(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
CFMutableArrayRef domains;
if (argc < 1) {
static int
__doDNSServerAddresses(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
CFMutableArrayRef servers;
if (argc < 1) {
static int
__doIPv4ConfigMethod(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
+#pragma unused(argc)
+#pragma unused(argv)
unsigned int flags;
CFStringRef method;
CFIndex methodIndex;
static int
__doIPv4Addresses(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(argc)
Boolean useArray = (info == (void *)FALSE) ? FALSE : TRUE;
if (strlen(argv[0]) > 0) {
static int
__doIPv6ConfigMethod(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
+#pragma unused(argc)
+#pragma unused(argv)
unsigned int flags;
CFStringRef method;
CFIndex methodIndex;
static int
__doIPv6Addresses(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(argc)
Boolean useArray = (info == (void *)FALSE) ? FALSE : TRUE;
if (strlen(argv[0]) > 0) {
static int
__doProxySelect(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(key)
+#pragma unused(description)
+#pragma unused(newConfiguration)
CFIndex nextOption;
if (argc < 1) {
static int
__doProxyEnable(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(key)
+#pragma unused(description)
+#pragma unused(argc)
+#pragma unused(argv)
Boolean enabled = (info == (void *)FALSE) ? FALSE : TRUE;
if (currentProxy == NULL) {
static int
__doProxyHost(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(key)
+#pragma unused(description)
+#pragma unused(info)
if (currentProxy == NULL) {
SCPrint(TRUE, stdout, CFSTR("proxy not specified\n"));
return -1;
static int
__doProxyPort(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(key)
+#pragma unused(description)
+#pragma unused(info)
if (currentProxy == NULL) {
SCPrint(TRUE, stdout, CFSTR("proxy not specified\n"));
return -1;
static int
__doProxyURL(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(key)
+#pragma unused(description)
+#pragma unused(info)
if (currentProxy == NULL) {
SCPrint(TRUE, stdout, CFSTR("proxy not specified\n"));
return -1;
static int
__doProxyFTPPassive(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(key)
+#pragma unused(description)
+#pragma unused(info)
+#pragma unused(argc)
+#pragma unused(argv)
+#pragma unused(newConfiguration)
if (currentProxy == NULL) {
SCPrint(TRUE, stdout, CFSTR("proxy not specified\n"));
return -1;
static int
__doSMBName(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
if (argc < 1) {
SCPrint(TRUE, stdout, CFSTR("NetBIOS name not specified\n"));
return -1;
static int
__doSMBWorkgroup(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
if (argc < 1) {
SCPrint(TRUE, stdout, CFSTR("Workgroup not specified\n"));
return -1;
static int
__doSMBWINSAddresses(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
{
+#pragma unused(description)
+#pragma unused(info)
CFMutableArrayRef servers;
if (argc < 1) {
void
show_protocols(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
CFIndex i;
CFIndex n;
sorted = CFArrayCreateMutableCopy(NULL, 0, protocols);
CFArraySortValues(sorted,
CFRangeMake(0, n),
- _compare_protocols,
+ _SCNetworkProtocolCompare,
NULL);
CFRelease(protocols);
protocols = sorted;
CFArrayGetValueAtIndex(addresses, 0));
} else if (CFEqual(method, kSCValNetIPv4ConfigMethodManual) &&
isA_CFArray(addresses)) {
+ CFStringRef router;
+
CFStringAppendFormat(description,
NULL,
CFSTR("%@, address=%@"),
method,
CFArrayGetValueAtIndex(addresses, 0));
+
+ if (CFDictionaryGetValueIfPresent(configuration,
+ kSCPropNetIPv4Router,
+ (const void **)&router) &&
+ isA_CFString(router)) {
+ CFStringAppendFormat(description,
+ NULL,
+ CFSTR(", router=%@"),
+ router);
+ }
} else {
CFStringAppendFormat(description,
NULL,
method);
}
} else if (CFEqual(protocolType, kSCNetworkProtocolTypeProxies)) {
- CFIndex i;
static proxyKeys *keys[] = { &proxyKeys_FTP, &proxyKeys_Gopher, &proxyKeys_HTTP, &proxyKeys_HTTPS,
&proxyKeys_RTSP, &proxyKeys_SOCKS, &proxyKeys_PAC, &proxyKeys_WPAD };
- for (i = 0; i < sizeof(keys)/sizeof(keys[0]); i++) {
+ for (size_t i = 0; i < sizeof(keys)/sizeof(keys[0]); i++) {
proxyKeys *currentProxy = keys[i];
if (!__proxy_enabled(configuration, currentProxy->keyEnable)) {
/*
- * Copyright (c) 2004, 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2011, 2017 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
__BEGIN_DECLS
-CFComparisonResult _compare_protocols (const void *val1, const void *val2, void *context);
-
CF_RETURNS_RETAINED
CFStringRef _protocol_description (SCNetworkProtocolRef protocol, Boolean skipEmpty);
/*
- * Copyright (c) 2004-2010, 2013, 2014, 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2010, 2013, 2014, 2016, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
void
select_service(int argc, char **argv)
{
+#pragma unused(argc)
SCNetworkInterfaceRef interface;
SCNetworkServiceRef service;
CFStringRef serviceName;
sorted = CFArrayCreateMutableCopy(NULL, 0, protocols);
CFArraySortValues(sorted,
CFRangeMake(0, n),
- _compare_protocols,
+ _SCNetworkProtocolCompare,
NULL);
CFRelease(protocols);
protocols = sorted;
// nothing to report
break;
case kSCNetworkServicePrimaryRankFirst :
- SCPrint(TRUE, stdout, CFSTR("primary rank = FIRST\n"));
+ SCPrint(TRUE, stdout, CFSTR("primary rank = %@\n"), kSCValNetServicePrimaryRankFirst);
break;
case kSCNetworkServicePrimaryRankLast :
- SCPrint(TRUE, stdout, CFSTR("primary rank = LAST\n"));
+ SCPrint(TRUE, stdout, CFSTR("primary rank = %@\n"), kSCValNetServicePrimaryRankLast);
break;
case kSCNetworkServicePrimaryRankNever :
- SCPrint(TRUE, stdout, CFSTR("primary rank = NEVER\n"));
+ SCPrint(TRUE, stdout, CFSTR("primary rank = %@\n"), kSCValNetServicePrimaryRankNever);
break;
case kSCNetworkServicePrimaryRankScoped :
- SCPrint(TRUE, stdout, CFSTR("primary rank = SCOPED\n"));
+ SCPrint(TRUE, stdout, CFSTR("primary rank = %@\n"), kSCValNetServicePrimaryRankScoped);
break;
default :
SCPrint(TRUE, stdout, CFSTR("primary rank = %d\n"), serviceRank);
sorted = CFArrayCreateMutableCopy(NULL, 0, protocols);
CFArraySortValues(sorted,
CFRangeMake(0, n),
- _compare_protocols,
+ _SCNetworkProtocolCompare,
NULL);
CFRelease(protocols);
protocols = sorted;
void
show_services(int argc, char **argv)
{
+#pragma unused(argv)
CFIndex i;
CFIndex n;
/*
- * Copyright (c) 2004, 2005, 2009-2011, 2013-2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2004, 2005, 2009-2011, 2013-2015, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
/* -------------------- */
-static CFComparisonResult
-_compare_sets(const void *val1, const void *val2, void *context)
-{
- CFStringRef id1;
- CFStringRef id2;
- CFStringRef name1;
- CFStringRef name2;
- SCNetworkSetRef s1 = (SCNetworkSetRef)val1;
- SCNetworkSetRef s2 = (SCNetworkSetRef)val2;
-
- name1 = SCNetworkSetGetName(s1);
- name2 = SCNetworkSetGetName(s2);
-
- if (name1 != NULL) {
- if (name2 != NULL) {
- return CFStringCompare(name1, name2, 0);
- } else {
- return kCFCompareLessThan;
- }
- }
-
- if (name2 != NULL) {
- return kCFCompareGreaterThan;
- }
-
- id1 = SCNetworkSetGetSetID(s1);
- id2 = SCNetworkSetGetSetID(s2);
- return CFStringCompare(id1, id2, 0);
-}
-
-
static CFArrayRef
_copy_sets()
{
sorted = CFArrayCreateMutableCopy(NULL, 0, sets);
CFArraySortValues(sorted,
CFRangeMake(0, CFArrayGetCount(sorted)),
- _compare_sets,
+ _SCNetworkSetCompare,
NULL);
CFRelease(sets);
void
select_set(int argc, char **argv)
{
+#pragma unused(argc)
SCNetworkSetRef set;
CFStringRef setName;
n = CFArrayGetCount(interfaces);
for (i = 0; i < n; i++) {
interface = CFArrayGetValueAtIndex(interfaces, i);
- SCPrint(TRUE, stdout, CFSTR(" %2ld: %@ \n"),
+ SCPrint(TRUE, stdout, CFSTR(" %2ld: %@\n"),
i + 1,
SCNetworkInterfaceGetLocalizedDisplayName(interface));
}
void
show_sets(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
SCNetworkSetRef current;
CFIndex i;
CFIndex n;
/*
- * Copyright (c) 2000-2005, 2008-2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2008-2015, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static char *
elapsed()
{
- int n;
+ size_t n;
static char str[128];
struct tm tm_diff;
struct tm tm_now;
static CFComparisonResult
-sort_keys(const void *p1, const void *p2, void *context) {
+sort_keys(const void *p1, const void *p2, void *context)
+{
+#pragma unused(context)
CFStringRef key1 = (CFStringRef)p1;
CFStringRef key2 = (CFStringRef)p2;
return CFStringCompare(key1, key2, 0);
void
storeCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
{
+#pragma unused(info)
int i;
CFIndex n;
void
do_notify_list(int argc, char **argv)
{
+#pragma unused(argv)
int i;
CFArrayRef list;
CFIndex listCnt;
void
do_notify_changes(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
CFArrayRef list;
CFIndex listCnt;
int i;
static void *
_watcher(void *arg)
{
+#pragma unused(arg)
notifyRl = CFRunLoopGetCurrent();
if (notifyRl == NULL) {
SCPrint(TRUE, stdout, CFSTR(" CFRunLoopGetCurrent() failed\n"));
void
do_notify_watch(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
pthread_attr_t tattr;
pthread_t tid;
void
do_notify_wait(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (!SCDynamicStoreNotifyWait(store)) {
SCPrint(TRUE, stdout, CFSTR(" %s\n"), SCErrorString(SCError()));
return;
void
do_notify_cancel(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (notifyRls != NULL) {
if (doDispatch) {
if (!SCDynamicStoreSetDispatchQueue(store, NULL)) {
Boolean
_prefs_open(CFStringRef name, CFStringRef prefsID)
{
+#if TARGET_OS_EMBEDDED
+ char *env = NULL;
+#endif // TARGET_OS_EMBEDDED
CFMutableDictionaryRef options = NULL;
Boolean useHelper = FALSE;
Boolean useOptions = FALSE;
}
if (getenv("SCPREFERENCES_REMOVE_WHEN_EMPTY") != NULL) {
- // if we have options
- useOptions = TRUE;
-
if (options == NULL) {
options = CFDictionaryCreateMutable(NULL,
0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
+ useOptions = TRUE;
}
CFDictionarySetValue(options, kSCPreferencesOptionRemoveWhenEmpty, kCFBooleanTrue);
}
+#if TARGET_OS_EMBEDDED
+ env = getenv("SCPREFERENCES_PROTECTION_CLASS");
+ if (env != NULL) {
+ CFStringRef str;
+
+ if (options == NULL) {
+ options = CFDictionaryCreateMutable(NULL,
+ 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ useOptions = TRUE;
+ }
+ str = CFStringCreateWithCString(NULL, env, kCFStringEncodingASCII);
+ CFDictionarySetValue(options, kSCPreferencesOptionProtectionClass, str);
+ CFRelease(str);
+ }
+#endif // TARGET_OS_EMBEDDED
+
if (!useHelper && !useOptions) {
// if no helper/options needed
prefs = SCPreferencesCreate(NULL, name, prefsID);
static void
get_ComputerName(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
CFStringEncoding encoding;
CFStringRef hostname;
static void
get_HostName(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
CFStringRef hostname;
Boolean ok;
static void
get_LocalHostName(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
CFStringRef hostname;
hostname = SCDynamicStoreCopyLocalHostName(NULL);
void
do_prefs_lock(int argc, char **argv)
{
+#pragma unused(argv)
Boolean wait = (argc > 0) ? TRUE : FALSE;
if (!SCPreferencesLock(prefs, wait)) {
void
do_prefs_unlock(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (!SCPreferencesUnlock(prefs)) {
SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
return;
void
do_prefs_commit(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (!SCPreferencesCommitChanges(prefs)) {
SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
return;
void
do_prefs_apply(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (!SCPreferencesApplyChanges(prefs)) {
SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
}
void
do_prefs_synchronize(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
SCPreferencesSynchronize(prefs);
return;
}
static CFComparisonResult
-sort_paths(const void *p1, const void *p2, void *context) {
+sort_paths(const void *p1, const void *p2, void *context)
+{
+#pragma unused(context)
CFStringRef path1 = (CFStringRef)p1;
CFStringRef path2 = (CFStringRef)p2;
return CFStringCompare(path1, path2, 0);
void
do_prefs_get(int argc, char **argv)
{
+#pragma unused(argc)
CFDictionaryRef dict;
CFStringRef link;
CFIndex n;
void
do_prefs_remove(int argc, char **argv)
{
+#pragma unused(argc)
CFStringRef path;
path = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
static char *
prompt(EditLine *el)
{
+#pragma unused(el)
#if !TARGET_OS_SIMULATOR
return "> ";
#else // !TARGET_OS_SIMULATOR
/* process any arguments */
- while ((opt = getopt_long(argc, argv, "dDvprt:w:W", longopts, &opti)) != -1)
+ while ((opt = getopt_long(argc, argv, "dDvprt:w:W", longopts, &opti)) != -1) {
switch(opt) {
case 'd':
_sc_debug = TRUE;
default :
usage(prog);
}
+ }
+
argc -= optind;
argv += optind;
}
if (doSnap) {
- if (!enablePrivateAPI
-#if !TARGET_OS_SIMULATOR
- || (geteuid() != 0)
-#endif // !TARGET_OS_SIMULATOR
- ) {
+ if (!enablePrivateAPI) {
usage(prog);
}
/*
- * Copyright (c) 2000-2004, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2010, 2011, 2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
static void
reconnected(SCDynamicStoreRef store, void *info)
{
+#pragma unused(store)
+#pragma unused(info)
SCPrint(TRUE, stdout, CFSTR("SCDynamicStore server restarted, session reconnected\n"));
return;
}
void
do_open(int argc, char **argv)
{
+#pragma unused(argv)
if (store) {
CFRelease(store);
CFRelease(watchedKeys);
void
do_close(int argc, char **argv)
{
+#pragma unused(argc)
+#pragma unused(argv)
if (notifyRls != NULL) {
if (doDispatch) {
(void) SCDynamicStoreSetDispatchQueue(store, NULL);
/*
- * Copyright (c) 2000, 2001, 2003-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2017 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <dnsinfo.h>
#include "dnsinfo_internal.h"
+#include "dnsinfo_logging.h"
+
#include <network_information.h>
+#include "network_state_information_logging.h"
#include "network_state_information_priv.h"
+
#include "SCNetworkReachabilityInternal.h"
+
#include <CommonCrypto/CommonDigest.h>
_printReachability(SCNetworkReachabilityRef target)
{
SCNetworkReachabilityFlags flags;
+ char flags_str[100];
Boolean ok;
- CFStringRef str;
ok = SCNetworkReachabilityGetFlags(target, &flags);
if (!ok) {
return;
}
- str = __SCNetworkReachabilityCopyFlags(flags, CFSTR("flags = "), _sc_debug);
- SCPrint(TRUE, stdout, CFSTR("%@\n"), str);
- CFRelease(str);
+ __SCNetworkReachability_flags_string(flags, _sc_debug, flags_str, sizeof(flags_str));
+ SCPrint(TRUE, stdout,
+ _sc_debug ? CFSTR("flags = %s\n") : CFSTR("%s\n"),
+ flags_str);
if (resolver_bypass && _sc_debug) {
int if_index;
}
-static void
-_printNWIFlags(nwi_ifstate_flags flags)
-{
- flags &= NWI_IFSTATE_FLAGS_MASK;
- if (flags == 0) {
- return;
- }
-
- SCPrint(TRUE, stdout, CFSTR(" ("));
- if (flags & NWI_IFSTATE_FLAGS_HAS_IPV4) {
- SCPrint(TRUE, stdout, CFSTR("IPv4"));
- flags &= ~NWI_IFSTATE_FLAGS_HAS_IPV4;
- SCPrint(flags != 0, stdout, CFSTR(","));
- }
- if (flags & NWI_IFSTATE_FLAGS_HAS_IPV6) {
- SCPrint(TRUE, stdout, CFSTR("IPv6"));
- flags &= ~NWI_IFSTATE_FLAGS_HAS_IPV6;
- SCPrint(flags != 0, stdout, CFSTR(","));
- }
- if (flags & NWI_IFSTATE_FLAGS_HAS_DNS) {
- SCPrint(TRUE, stdout, CFSTR("DNS"));
- flags &= ~NWI_IFSTATE_FLAGS_HAS_DNS;
- SCPrint(flags != 0, stdout, CFSTR(","));
- }
- if (flags & NWI_IFSTATE_FLAGS_NOT_IN_LIST) {
- SCPrint(TRUE, stdout, CFSTR("NOT-IN-LIST"));
- flags &= ~NWI_IFSTATE_FLAGS_NOT_IN_LIST;
- SCPrint(flags != 0, stdout, CFSTR(","));
- }
- if (flags & NWI_IFSTATE_FLAGS_HAS_SIGNATURE) {
- SCPrint(TRUE, stdout, CFSTR("SIGNATURE"));
- flags &= ~NWI_IFSTATE_FLAGS_HAS_SIGNATURE;
- SCPrint(flags != 0, stdout, CFSTR(","));
- }
- if (flags & NWI_IFSTATE_FLAGS_NOT_IN_IFLIST) {
- SCPrint(TRUE, stdout, CFSTR("NOT-IN-IFLIST"));
- flags &= ~NWI_IFSTATE_FLAGS_NOT_IN_IFLIST;
- SCPrint(flags != 0, stdout, CFSTR(","));
- }
- if (flags != 0) {
- SCPrint(TRUE, stdout, CFSTR("%p"), (void *)flags);
- }
- SCPrint(TRUE, stdout, CFSTR(")"));
-
- return;
-}
-
-
-static void
-_printNWIInfo(nwi_ifstate_t ifstate)
-{
- nwi_ifstate_flags ifstate_flags;
- SCNetworkReachabilityFlags reach_flags = nwi_ifstate_get_reachability_flags(ifstate);
- const uint8_t *signature;
- int signature_length;
- CFStringRef str;
- const struct sockaddr *vpn_addr = nwi_ifstate_get_vpn_server(ifstate);
-
- ifstate_flags = nwi_ifstate_get_flags(ifstate);
- if (_sc_debug) {
- ifstate_flags |= ifstate->flags;
- }
-
- SCPrint(TRUE, stdout,
- CFSTR(" %7s : flags %p"),
- nwi_ifstate_get_ifname(ifstate),
- (void *)ifstate_flags);
- _printNWIFlags(ifstate_flags);
-
- str = __SCNetworkReachabilityCopyFlags(reach_flags, CFSTR(" reach "), TRUE);
- SCPrint(TRUE, stdout, CFSTR("\n%@"), str);
- CFRelease(str);
-
- if (vpn_addr != NULL) {
- char vpn_ntopbuf[INET6_ADDRSTRLEN];
-
- _SC_sockaddr_to_string(vpn_addr, vpn_ntopbuf, sizeof(vpn_ntopbuf));
- SCPrint(TRUE, stdout, CFSTR("\n VPN server: %s"), vpn_ntopbuf);
- }
-
- signature = nwi_ifstate_get_signature(ifstate, AF_UNSPEC, &signature_length);
- if (signature != NULL) {
- CFDataRef digest = NULL;
-
- digest = CFDataCreate(NULL, signature, CC_SHA1_DIGEST_LENGTH);
- SCPrint(TRUE, stdout, CFSTR("\n Signature Hash: %@"), digest);
- CFRelease(digest);
- } else {
- SCPrint(TRUE, stdout, CFSTR("\n Signature Hash: <empty>"));
- }
-
- SCPrint(TRUE, stdout, CFSTR("\n generation %llu\n"),
- nwi_ifstate_get_generation(ifstate));
-
- return;
-}
-
-
-static void
-_printNWIReachInfo(nwi_state_t state, int af)
-{
- uint32_t reach_flags;
- CFStringRef str;
-
- reach_flags = nwi_state_get_reachability_flags(state, af);
-
- str = __SCNetworkReachabilityCopyFlags(reach_flags, CFSTR(" REACH : flags "), TRUE);
- SCPrint(TRUE, stdout, CFSTR("\n%@\n"), str);
- CFRelease(str);
-
- return;
-}
-
-
static void
do_printNWI(int argc, char **argv, nwi_state_t state)
{
- unsigned int count;
- nwi_ifstate_t ifstate;
-
if (state == NULL) {
SCPrint(TRUE, stdout, CFSTR("No network information\n"));
return;
}
if (argc > 0) {
+ nwi_ifstate_t ifstate;
+
ifstate = nwi_state_get_ifstate(state, argv[0]);
if (ifstate != NULL) {
nwi_ifstate_t alias;
+ int alias_af;
- _printNWIInfo(ifstate);
+ _nwi_ifstate_log(ifstate, _sc_debug, NULL);
- alias = nwi_ifstate_get_alias(ifstate,
- ifstate->af == AF_INET ? AF_INET6 : AF_INET);
+ alias_af = (ifstate->af == AF_INET) ? AF_INET6 : AF_INET;
+ alias = nwi_ifstate_get_alias(ifstate, alias_af);
if (alias != NULL) {
SCPrint(TRUE, stdout, CFSTR("\n"));
- _printNWIInfo(alias);
+ _nwi_ifstate_log(alias, _sc_debug, NULL);
}
} else {
SCPrint(TRUE, stdout, CFSTR("No network information (for %s)\n"), argv[0]);
return;
}
- SCPrint(TRUE, stdout, CFSTR("Network information (generation %llu)"),
- nwi_state_get_generation(state));
-
- SCPrint(TRUE, stdout, CFSTR("\nIPv4 network interface information\n"));
-
- ifstate = nwi_state_get_first_ifstate(state, AF_INET);
- if (ifstate == NULL) {
- SCPrint(TRUE, stdout, CFSTR(" No IPv4 states found\n"));
- } else {
- while (ifstate != NULL) {
- _printNWIInfo(ifstate);
- ifstate = nwi_ifstate_get_next(ifstate, AF_INET);
- }
- }
- _printNWIReachInfo(state, AF_INET);
-
- SCPrint(TRUE, stdout, CFSTR("\nIPv6 network interface information\n"));
-
- ifstate = nwi_state_get_first_ifstate(state, AF_INET6);
- if (ifstate == NULL) {
- SCPrint(TRUE, stdout, CFSTR(" No IPv6 states found\n"));
- } else {
- while (ifstate != NULL) {
- _printNWIInfo(ifstate);
- ifstate = nwi_ifstate_get_next(ifstate, AF_INET6);
- }
- }
- _printNWIReachInfo(state, AF_INET6);
-
- count = nwi_state_get_interface_names(state, NULL, 0);
- if (count > 0) {
- const char * names[count];
-
- count = nwi_state_get_interface_names(state, names, count);
- if (count > 0) {
- int i;
-
- printf("\nNetwork interfaces:");
- for (i = 0; i < count; i++) {
- printf(" %s", names[i]);
- }
- printf("\n");
- }
- }
+ _nwi_state_log(state, _sc_debug, NULL);
return;
}
&token,
dispatch_get_main_queue(),
^(int token){
+#pragma unused(token)
nwi_state_t state;
struct tm tm_now;
struct timeval tv_now;
static void
do_printDNSConfiguration(int argc, char **argv, dns_config_t *dns_config)
{
+#pragma unused(argc)
+#pragma unused(argv)
int _sc_log_save;
if (dns_config == NULL) {
_sc_log_save = _sc_log;
_sc_log = FALSE;
- _dns_configuration_log(dns_config, _sc_debug);
+ _dns_configuration_log(dns_config, _sc_debug, NULL);
_sc_log = _sc_log_save;
if (_sc_debug) {
&token,
dispatch_get_main_queue(),
^(int token){
+#pragma unused(token)
dns_config_t *dns_config;
struct tm tm_now;
struct timeval tv_now;
void
do_snapshot(int argc, char **argv)
{
- if (!SCDynamicStoreSnapshot(store)) {
- SCPrint(TRUE, stdout, CFSTR(" %s\n"), SCErrorString(SCError()));
+#pragma unused(argc)
+#pragma unused(argv)
+ if (argc == 1) {
+ CFDictionaryRef dict;
+ int fd;
+ CFMutableArrayRef patterns;
+
+ fd = open(argv[0], O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+ if (fd == -1) {
+ SCPrint(TRUE, stdout, CFSTR("open() failed: %s\n"), strerror(errno));
+ return;
+ }
+
+ patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+ CFArrayAppendValue(patterns, CFSTR(".*"));
+ dict = SCDynamicStoreCopyMultiple(store, NULL, patterns);
+ CFRelease(patterns);
+ if (dict != NULL) {
+ CFDataRef xmlData;
+
+ xmlData = CFPropertyListCreateData(NULL, dict, kCFPropertyListXMLFormat_v1_0, 0, NULL);
+ CFRelease(dict);
+ if (xmlData != NULL) {
+ (void) write(fd, CFDataGetBytePtr(xmlData), CFDataGetLength(xmlData));
+ CFRelease(xmlData);
+ } else {
+ SC_log(LOG_NOTICE, "CFPropertyListCreateData() failed");
+ }
+ } else {
+ if (SCError() == kSCStatusOK) {
+ SCPrint(TRUE, stdout, CFSTR("No SCDynamicStore content\n"));
+ } else {
+ SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+ }
+ }
+ (void) close(fd);
+ } else {
+#if !TARGET_OS_SIMULATOR
+ if (geteuid() != 0) {
+ SCPrint(TRUE, stdout, CFSTR("Need to be \"root\" to capture snapshot\n"));
+ } else
+#endif // !TARGET_OS_SIMULATOR
+ if (!SCDynamicStoreSnapshot(store)) {
+ SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+ }
}
return;
static void
waitTimeout(int sigraised)
{
+#pragma unused(sigraised)
exit(1);
}
--- /dev/null
+#!/bin/sh
+
+#
+# fix address-sanitizer library @rpath references
+#
+
+xsan_setup() {
+ XSAN_DIR="/usr/local/lib/sanitizers"
+ case "${PLATFORM_NAME}" in
+ macosx )
+ ASAN_DYLIB="clang_rt.asan_osx_dynamic.dylib"
+ TSAN_DYLIB="clang_rt.tsan_osx_dynamic.dylib"
+ ;;
+ iphoneos )
+ ASAN_DYLIB="clang_rt.asan_ios_dynamic.dylib"
+ TSAN_DYLIB="clang_rt.tsan_ios_dynamic.dylib"
+ ;;
+ iphonesimulator )
+ ASAN_DYLIB="clang_rt.asan_iossim_dynamic.dylib"
+ TSAN_DYLIB="clang_rt.tsan_iossim_dynamic.dylib"
+ ;;
+ tvos )
+ ASAN_DYLIB="clang_rt.asan_tvos_dynamic.dylib"
+ TSAN_DYLIB="clang_rt.tsan_tvos_dynamic.dylib"
+ ;;
+ tvsosimulator )
+ ASAN_DYLIB="clang_rt.asan_tvossim_dynamic.dylib"
+ TSAN_DYLIB="clang_rt.tsan_tvossim_dynamic.dylib"
+ ;;
+ watchos )
+ ASAN_DYLIB="clang_rt.asan_watchos_dynamic.dylib"
+ TSAN_DYLIB="clang_rt.tsan_watchos_dynamic.dylib"
+ ;;
+ watchsimulator )
+ ASAN_DYLIB="clang_rt.asan_watchossim_dynamic.dylib"
+ TSAN_DYLIB="clang_rt.tsan_watchossim_dynamic.dylib"
+ ;;
+ * )
+ ASAN_DYLIB="clang_rt.asan_$(RC_PROJECT_COMPILATION_PLATFORM)_dynamic.dylib"
+ TSAN_DYLIB="clang_rt.tsan_$(RC_PROJECT_COMPILATION_PLATFORM)_dynamic.dylib"
+ ;;
+ esac
+}
+
+xsan_setup=0
+for VARIANT in ${BUILD_VARIANTS}
+do
+ case "${VARIANT}" in
+ "asan" )
+ #
+ # change address sanitizer @rpath reference
+ #
+ ASAN_FILE="${DSTROOT}${INSTALL_PATH}/"
+ if [ -n "${EXECUTABLE_FOLDER_PATH}" ]; then
+ ASAN_FILE+="${EXECUTABLE_FOLDER_PATH}/"
+ fi
+ ASAN_FILE+="${EXECUTABLE_PREFIX}${PRODUCT_NAME}_asan${EXECUTABLE_SUFFIX}"
+
+ if [ -x "${ASAN_FILE}" ]; then
+ if [ ${xsan_setup} -eq 0 ]; then
+ xsan_setup
+ xsan_setup=1
+ fi
+
+ install_name_tool \
+ -change \
+ "@rpath/lib${ASAN_DYLIB}" \
+ "${XSAN_DIR}/lib${ASAN_DYLIB}" \
+ "${ASAN_FILE}"
+ if [ $? -ne 0 ]; then
+ echo "install_name_tool failed"
+ printenv | sort
+ exit 1
+ fi
+ fi
+ ;;
+ "tsan" )
+ #
+ # change thread sanitizer @rpath reference
+ #
+ TSAN_FILE="${DSTROOT}${INSTALL_PATH}/"
+ if [ -n "${EXECUTABLE_FOLDER_PATH}" ]; then
+ TSAN_FILE+="${EXECUTABLE_FOLDER_PATH}/"
+ fi
+ TSAN_FILE+="${EXECUTABLE_PREFIX}${PRODUCT_NAME}_tsan${EXECUTABLE_SUFFIX}"
+
+ if [ -x "${TSAN_FILE}" ]; then
+ if [ ${xsan_setup} -eq 0 ]; then
+ xsan_setup
+ xsan_setup=1
+ fi
+
+ install_name_tool \
+ -change \
+ "@rpath/lib${TSAN_DYLIB}" \
+ "${XSAN_DIR}/lib${TSAN_DYLIB}" \
+ "${TSAN_FILE}"
+ if [ $? -ne 0 ]; then
+ echo "install_name_tool failed"
+ printenv | sort
+ exit 1
+ fi
+ fi
+ ;;
+ * )
+ ;;
+ esac
+done