System Configuration

RSS for tag

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

Posts under System Configuration tag

85 Posts

Post

Replies

Boosts

Views

Activity

DNS in VPN split tunneling
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?
1
0
1.1k
Oct ’21
CNCopySupportedInterfaces takes around 30-40s to return current connected ssid.
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; }
5
0
1.4k
Sep ’21
NEHotspotConfigurationManager - iPhone internal error
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
1
0
1.6k
Aug ’21
Default IPv6 route not restored
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!
3
0
2.6k
Aug ’21
Reachability doesn't detect LTE/5G on iOS 14/iPhone 12
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?
1
0
1.3k
Aug ’21
DNS in VPN split tunneling
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?
Replies
1
Boosts
0
Views
1.1k
Activity
Oct ’21
CNCopySupportedInterfaces takes around 30-40s to return current connected ssid.
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; }
Replies
5
Boosts
0
Views
1.4k
Activity
Sep ’21
NEHotspotConfigurationManager - iPhone internal error
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
Replies
1
Boosts
0
Views
1.6k
Activity
Aug ’21
Default IPv6 route not restored
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!
Replies
3
Boosts
0
Views
2.6k
Activity
Aug ’21
Reachability doesn't detect LTE/5G on iOS 14/iPhone 12
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?
Replies
1
Boosts
0
Views
1.3k
Activity
Aug ’21