X-Git-Url: https://git.saurik.com/apple/configd.git/blobdiff_plain/9de8ab86392ba34369adc6be0bfc21bad9b7caa2..78deefe8e371573ba1c4e975adf72db0dddc81f9:/Plugins/KernelEventMonitor/ev_ipv4.c?ds=sidebyside diff --git a/Plugins/KernelEventMonitor/ev_ipv4.c b/Plugins/KernelEventMonitor/ev_ipv4.c index d0b765e..55c4cf2 100644 --- a/Plugins/KernelEventMonitor/ev_ipv4.c +++ b/Plugins/KernelEventMonitor/ev_ipv4.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2015 Apple Inc. All rights reserved. + * Copyright (c) 2002-2018 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -29,19 +29,8 @@ */ #include "eventmon.h" -#include "cache.h" #include "ev_ipv4.h" -#ifndef kSCEntNetIPv4ARPCollision -#define kSCEntNetIPv4ARPCollision CFSTR("IPv4ARPCollision") -#endif /* kSCEntNetIPv4ARPCollision */ - -#if !TARGET_OS_IPHONE -#ifndef kSCEntNetIPv4PortInUse -#define kSCEntNetIPv4PortInUse CFSTR("PortInUse") -#endif /* kSCEntNetIPv4PortInUse */ -#endif /* !TARGET_OS_IPHONE */ - #define IP_FORMAT "%d.%d.%d.%d" #define IP_CH(ip, i) (((u_char *)(ip))[i]) #define IP_LIST(ip) IP_CH(ip,0),IP_CH(ip,1),IP_CH(ip,2),IP_CH(ip,3) @@ -80,7 +69,7 @@ copyIF(CFStringRef key, CFMutableDictionaryRef oldIFs, CFMutableDictionaryRef ne if (CFDictionaryGetValueIfPresent(newIFs, key, (const void **)&dict)) { newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict); } else { - dict = cache_SCDynamicStoreCopyValue(store, key); + dict = SCDynamicStoreCopyValue(store, key); if (dict) { CFDictionarySetValue(oldIFs, key, dict); if (isA_CFDictionary(dict)) { @@ -117,10 +106,16 @@ updateStore(const void *key, const void *value, void *context) if (!dict || !CFEqual(dict, newDict)) { if (CFDictionaryGetCount(newDict) > 0) { SC_log(LOG_DEBUG, "Update interface configuration: %@: %@", key, newDict); - cache_SCDynamicStoreSetValue(store, key, newDict); + SCDynamicStoreSetValue(store, key, newDict); } else if (dict) { - SC_log(LOG_DEBUG, "Update interface configuration: %@: ", key); - cache_SCDynamicStoreRemoveValue(store, key); + CFDictionaryRef oldDict; + + oldDict = SCDynamicStoreCopyValue(store, key); + if (oldDict != NULL) { + SC_log(LOG_DEBUG, "Update interface configuration: %@: ", key); + CFRelease(oldDict); + } + SCDynamicStoreRemoveValue(store, key); } network_changed = TRUE; } @@ -263,7 +258,7 @@ ipv4_arp_collision(const char *if_name, struct in_addr ip_addr, int hw_len, cons (i == 0) ? "/" : ":", hw_addr_bytes[i]); } SC_log(LOG_DEBUG, "Post ARP collision: %@", key); - cache_SCDynamicStoreNotifyValue(store, key); + SCDynamicStoreNotifyValue(store, key); CFRelease(key); CFRelease(prefix); CFRelease(if_name_cf); @@ -285,7 +280,7 @@ ipv4_port_in_use(uint16_t port, pid_t req_pid) kSCEntNetIPv4PortInUse, port, req_pid); SC_log(LOG_DEBUG, "Post port-in-use: %@", key); - cache_SCDynamicStoreNotifyValue(store, key); + SCDynamicStoreNotifyValue(store, key); CFRelease(key); return; } @@ -305,7 +300,7 @@ interface_notify_entity(const char * if_name, const char * type, CFStringRef ent entity); CFRelease(if_name_cf); SC_log(LOG_DEBUG, "Post %s: %@", type, key); - cache_SCDynamicStoreNotifyValue(store, key); + SCDynamicStoreNotifyValue(store, key); CFRelease(key); return; }