System Configuration

RSS for tag

System Configuration allows applications to access a device’s network configuration settings and determine the reachability of the device.

System Configuration Documentation

Posts under System Configuration tag

18 Posts
Sort by:
Post not yet marked as solved
5 Replies
203 Views
That's pretty much the question: we've got a tunnel provider, and I think the OS' ability to handle a captive portal situation is better than I could do, so is there a way to find out if we are in one, and if so wait for it to be handled by the user before we start doing things?
Posted
by kithrup.
Last updated
.
Post not yet marked as solved
1 Replies
474 Views
I’ve been battling some sort of exploit for some time now and hitting dead ends. I’ve discovered several unknown adapters/controllers and various cloned Bluetooth Advertisements. Can Anyone Identify these? skywalk_fsw_reap_en0 AppleS5L8940XI2CController AppleBCMWLANBusInterfacePCIe skywalk_doorbell_pdp_ip0_tx not familiar with these either.. Strange.. dlil_input_en2 dlil_input_ap1 dlil_input_XHC0 Any help is much appreciated.. Also, have many more just thinking this would be a good start.
Posted
by Rdz631.
Last updated
.
Post not yet marked as solved
1 Replies
160 Views
Hi, I'm using the reachability framework in order to register network status event for a specific address (address_st in the code below)... I'd like to support change of address which will trigger unregister from the old address and register to the new one. How can it be done ? SCNetworkReachabilityRef reachabilityRef = SCNetworkReachabilityCreateWithAddress(NULL, reinterpret_cast<sockaddr *>(&address_st)); SCNetworkReachabilityContext context = {0, NULL, NULL, NULL, NULL}; SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context)) SCNetworkReachabilitySetDispatchQueue(reachabilityRef, dispatch_queue_create("com.reachability.test", nil)); thanks,
Posted
by chapo213.
Last updated
.
Post not yet marked as solved
6 Replies
431 Views
Hi, I'm writing an XPC Service hosted in a container app. This service is expected to trigger IPC when some URL of interest become reachable. I'm using SCNetworkReachability (Reachability class provided as sample code from Apple). The reachability notification runs fine when running from the container app. However the XPC Service is never triggered of any network change. I'm suspecting something related to RunLoop or RunLoopMode (XPCListener is instantiated with serviceListener) but cannot find any fix. I disabled sandboxing without success (and anyway it runs fine with sandboxed container + network client entitlement). Any suggestion ?
Posted Last updated
.
Post not yet marked as solved
27 Replies
9.5k Views
Altough we are using NEHotspotConfiguration API to configure the current Wi-Fi network, occasionally CNCopyCurrentNetworkInfo returns NULL. The only way to recover was rebooting the phone (I haven't tried resetting the network settings as was suggested else where). Regardless ,this sounds like a bug in the API and I was wondering if others see the same problem and/or if it's a known issue and is getting addressed.Thanks!
Posted
by Glauco.
Last updated
.
Post not yet marked as solved
1 Replies
281 Views
Since 12.2, network preferences does not return VPN connections anymore. Therefore, VPN autoconnect scripts / Applications do not work anymore. tell application "System Events" tell current location of network preferences name of every service end tell end tell Returns: {"USB 10/100/1000 LAN", "WLAN", "iPhone-USB", "Thunderbolt Bridge"} Has the API changed?
Posted
by robert.o..
Last updated
.
Post not yet marked as solved
1 Replies
234 Views
Sorry about the title, it's kind of awkward. Basically, I have an ASOC app that I'd like to port to swift as a learning excercise. it's pretty straightforward, it grabs the computer name, local host name, and host name via the scutil --get operations and lets you change those via the --set. doing this in ASOC is dead simple, yay do shell script, and I mostly found a way to do it via NSAppleScript, but it feels very...awkward. Is there a better framework to use for getting and setting this info? thanks! john
Posted Last updated
.
Post not yet marked as solved
1 Replies
515 Views
Hello everyone! We are trying to implement secure VPN application and need to route traffic from our internal VPN server to external wifi / cellular network of iOS device. On android we already done this with VPN client + proxy server running in background. Is there any way to do this on iOS? We think two ways of implementation: Configure SNAT + VPN on iOS Background proxyserver (or something that could forward packets) and VPN client on iOS.
Posted
by NetDevil.
Last updated
.
Post not yet marked as solved
1 Replies
289 Views
Hello, I try to get the WiFi SSID, from the iPhone, with the CNCopyCurrentNetworkInfo function. I become as interface "en0" and the error message: [43481:8106022] [] nehelper sent invalid result code [1] for Wi-Fi information request I don't no where is the problem. My function for the SSID request is this one:             for i in 0..<CFArrayGetCount(interface) {               let interfaceName: UnsafeRawPointer = CFArrayGetValueAtIndex(interface, i)                 print(interface)               let rec = unsafeBitCast(interfaceName, to: AnyObject.self)               if let unsafeInterfaceData = CNCopyCurrentNetworkInfo("\(rec)" as CFString), let interfaceData = unsafeInterfaceData as? [String : AnyObject] {                 // connected wifi                 print("BSSID: \(interfaceData["BSSID"]), SSID: \(interfaceData["SSID"]), SSIDDATA: \(interfaceData["SSIDDATA"])")               } else {                 // not connected wifi               }             }           } if you have any idea where is my problem pleas help me. With best regards Niklas
Posted
by Nik0696.
Last updated
.
Post not yet marked as solved
1 Replies
284 Views
Our VPN client rely on __SCNetworkReachability to detect any network change, It works fine normally but recently we have started seeing some issues with customer environment, Reachability goes down frequently. When we looked at logs we have seen host name resolved to two IP address one IPv4 address and other mapped IPv6 IP (i.e 64:ff9b::b96e:55c5). Irrespective of which IP is being used with Reachability class (IPv4 or mapped IPv6) problem is not going away. VPN connects fine and immediately within 1 or 2 secs reachability changes and this put the VPN back to connecting state. Note: This issue is not observed in WIFI or any mobile network doesn't provide mapped IP.
Posted
by mmeera.
Last updated
.
Post not yet marked as solved
0 Replies
265 Views
We started discussing how we'll deal with captive portals, and I realized I don't know if CNA results in network change events. Does it? (I don't have a captive network here, and lockdown makes it hard to go find one, and making one would be ... quite a bit of work.)
Posted
by kithrup.
Last updated
.
Post not yet marked as solved
3 Replies
452 Views
My users get a prompt that disrupts the use of my app. The prompt comes more than 10 seconds into using a remote controlled IoT device via WiFi. The device is a drone, so it's not plausible to pause and it's absurd to have them wait so long for this prompt to appear to begin flight safely. The Wi-Fi network "MySSID" does not appear to be connected to the Internet Do you want to temporarily use cellular data? Use Cellular Data Keep Trying Wi-Fi I connect with NEHotspotConfigurationManager https://developer.apple.com/documentation/networkextension/nehotspotconfigurationmanager     hotspotConfig = NEHotspotConfiguration(ssid: mySSID)     guard let hotspotConfig = hotspotConfig else {       print("Error while connecting to WiFi")       return     }     hotspotConfig.joinOnce = true     NEHotspotConfigurationManager.shared.removeConfiguration(forSSID: ssid)     NEHotspotConfigurationManager.shared.apply(hotspotConfig) { [self] (error) in       if let error = error {         print(self.handleConnectionError(error))         completion(false)       } else if self.wifiConnectionInfo() != nil {         completion(true)       } else {         completion(false)       }     } How do I prevent this? Or is there any workaround?
Posted
by mellis94.
Last updated
.
Post not yet marked as solved
1 Replies
441 Views
Hi all. I have the following scenario; MacOs only with IPv6 support (IPv4 disabled). VPN application with both IPv4 and IPv6 support. My VPN app is creating three services thru NetworkConfiguration API; one is to register DNS (for IPv4 and IPv6), second is the IPv4 service with tunnel information (with override set to 0, because I have split tunnelling). Third is the IPv6 service, with tunnel IP also. I'm facing a problem with DNS, when the Override is set to true, I can see the DNS listed. But when override is set to disable, the DNS disappear. The idea is to have the IPv4 service with tunnel information, but with DNS configured. What is the best way to set the DNS when IPv4 and IPv6 tunnel are required?
Posted Last updated
.
Post not yet marked as solved
4 Replies
714 Views
In our iOS application there are many places where we need to fetch current connected ssid and we are fetching it from CNCopySupportedInterfaces.We are observing an issue where CNCopySupportedInterfaces is taking 30 to 40 seconds to fetch ssid name which is therefore blocking the main thread and leading to make our application crash. We did not find any issues calling this api CNCopySupportedInterfaces on main thread specified in any of the apple documents. Please note we are experiencing this issue only in a particular network environment. Code snippet : (NSString *)getwifiName{ NSString *wifiStr = nil; CFArrayRef arrayRef = CNCopySupportedInterfaces(); NSArray *interfaces = (_bridge NSArray *)arrayRef; if (interfaces) { for (NSString *interfaceName in interfaces) { CFDictionaryRef dictRef = CNCopyCurrentNetworkInfo((CFStringRef)interfaceName); if (dictRef != NULL) { NSDictionary *networkInfo = (bridge NSDictionary *)dictRef; wifiStr = [NSString stringWithFormat:@"%@",[networkInfo objectForKey:@"SSID"]]; CFRelease(dictRef); } } CFRelease(arrayRef); } if(wifiStr == nil) { wifiStr = [NSString stringWithFormat:NSLocalizedString(@"MobileDeviceWIFINotEnable",nil)]; } NSLog(@"Connected WifiStr - %@",wifiStr); return wifiStr; }
Posted
by Rupali01.
Last updated
.
Post not yet marked as solved
1 Replies
675 Views
Hello everyone, I tried to make my iPhone change the Wifi network using Xamarin.iOS. I have already contacted the Xamarin service who told me that the programming is translated 1:1 with Swift and that the problem is an internal iPhone error. My code is: public class ConnectToWifi : IConnectToWifi { string SSID; public string Password; public IPAddress ServerAddress; int ServerPort = -1; public bool isConnect = true; public CFSocket Socket; public CFSocket ServerSocket; NEHotspotConfigurationManager wifiManager; public ConnectToWifi() { wifiManager = new NEHotspotConfigurationManager(); } public async Task<bool> Connect(string Ip, int Port) { isConnect = false; ServerPort = Port; try { ServerAddress = new IPAddress(IPAddress.Parse(Ip).GetAddressBytes()); Socket = new CFSocket(); NEHotspotConfigurationManager.SharedManager.GetConfiguredSsids((listWifi) => { if (listWifi != null) { foreach (string ssid_selected in listWifi) { if (ssid_selected == SSID) { NEHotspotConfigurationManager.SharedManager.RemoveConfiguration(SSID); } } } }); NEHotspotConfiguration wifiNetwork = new NEHotspotConfiguration(SSID, Password, false); wifiNetwork.JoinOnce = true; wifiManager.ApplyConfiguration(wifiNetwork, (error) => { if (error != null) { System.Diagnostics.Debug.Write(error.Description); } else { System.Diagnostics.Debug.Write("Connected"); } isConnect = true; }); } catch (CFSocketException exception) { System.Diagnostics.Debug.WriteLine("Ho ricevuto questo errore nella Connect: " + exception.Message); return isConnect; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Ho ricevuto questo errore nella Connect: " + ex.Message); return isConnect; } return isConnect; } } Upon connection comes the wifiManager function.ApplyConfiguration returns the following error: ErrorDomain=NEHotspotConfigurationErrorDomain Code=8 "internal error." UserInfo={NSLocalizedDescription=internal error.} I have an iPhone X with iOS 14.6  and a MacBook with: MacOS Big Sur 14.5; Xcode Version 12.5.1; Visual Studio for Mac 8.10.7; Xamarin.iOS 14.20.0.24 (Visual Studio Community); In my AppID profile and in the Entitlements.plist file I have activated the following services: Access WiFi Information; Fonts; Hotspot; Network Extensions; Thank you very much for helping! Regards, Giacomo Ferrera
Posted Last updated
.
Post not yet marked as solved
3 Replies
850 Views
Hi! One part of my application is in charge of modifying the network configuration through the SystemConfiguration library. More specifically, I temporarily add entries under State:/Network/Service/Temp/DNS State:/Network/Service/Temp/IPv4 State:/Network/Service/Temp/IPv6 And then remove them when I'm done, expecting the network configuration to return to the one active before this procedure. I have noticed (at least in macOS Catalina) that the Default IPv6 route does not get properly restored if I do this. I can get it back by turning Off and On the network adapter, but I believe that should normally not be necessary. The steps to reproduce this are: 1) Configure a manual IPv6 address for the network adapter, for example: Router: 2001:db8:abcd:12::1 Address: 2001:db8:abcd:12::7 Prefix Length: 64 2) Check that the default IPv6 route is present through 'netsat -nr' language Internet6: Destination               Gateway             Flags     Netif Expire default                 2001:db8:abcd:12::1       UGc       en0     default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     3) Add an IPv6 entry using scutil language d.init d.add Addresses * 2001:db8:abcd:12::7 d.add InterfaceName en0 d.add PrefixLength * 64 d.add Router 2001:db8:abcd:12::1 set State:/Network/Service/Temp/IPv6 4) Default IPv6 route is still present language Internet6: Destination               Gateway             Flags     Netif Expire default                 2001:db8:abcd:12::1       UGc       en0     default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     5) Remove Temp entry language remove State:/Network/Service/Temp/IPv6  6) Default IPv6 route is gone language Internet6: Destination               Gateway             Flags     Netif Expire default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     7) Restart network adapter 8) Default IPv6 route reappears language Internet6: Destination               Gateway             Flags     Netif Expire default                 2001:db8:abcd:12::1       UGc       en0     default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     So, I wanted to know if I'm correctly assuming that the default route should not disappear after removing the IPv6 entry, and if there's any workaround I could use from within my application other than manually restarting the network adapter. Thanks!
Posted
by dlipicar.
Last updated
.
Post not yet marked as solved
1 Replies
605 Views
I use Reachability (https://developer.apple.com/library/archive/samplecode/Reachability/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007324) for detect network status. Not always, but in some cases( 5G / iPhone12, iOS 14 ?) can't detect network status when use LTE. when turn off LTE and use Wifi then it works. the other apps are running on LTE, same device. you have any idea?
Posted Last updated
.
Post not yet marked as solved
0 Replies
421 Views
When I'm trying to activate/incativate network service from command line, I use networksetup, and it works fine for pkt tunnel vpn config. The problem is that app proxy config is not listed, and could not be activated/inactivated from console, while it works through UI Netowrk Preferences. So when I run: networksetup listnetworkserviceorder the output doesn't match the list from Network Preferences, the app proxy configuration is not visible for this tool. It appears, that accessed from UI in Network Preferences service is not a recognized network service by networksetup. networksetup setnetworkserviceenabled TUNNEL_APP_PRXY_USR off TUNNEL_APP_PRXY_USR is not a recognized network service. ** Error: The parameters were not valid. What could go wrong and how to inactivate app proxy service from console?
Posted Last updated
.