Frequent network change detected in __SCNetworkReachability on Mobile network

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.

Note: This issue is not observed in WIFI or any mobile network doesn't provide mapped IP.

Okay, so it sounds like this only happen in very limited scope. Irregardless, the recommendation here is not to use to SCNetworkReachability family of APIs. It is often recommended not to even do network pre-flight checks, but for something like a NEPacketTunnelProvider there can be use-cases for at least knowing the reachability path. Which bring us to nw_path_monitor_t. This is the new API that is recommended in a context like packet tunnel provider if you need to be aware of path changes or updates. I would recommend replacing SCNetworkReachability with nw_path_monitor_t and see what this gets you.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Frequent network change detected in __SCNetworkReachability on Mobile network
 
 
Q