We are trying to figure out a way to find an API that can programatically help adding/deleting a routing address into/from a route table.
In MAC, this operation is achieved by providing "route" commands in the terminal. Eg. route -n add -net
We make use on NE PacketTunnelProvider for creating the tun interface were we can provide IPv4 routes. However at a later point of time we need to add routes as well. Do we have any provision from iOS that can be used to create route statically as done in MAC.
only from within the NE
Yes.
when we “Start” the VPN Tunnel
No. You must call it to start the tunnel but you can call it again to update the tunnel’s settings.
From the APP layer if I need to pass the new Route address Information (when the VPN connection is already up and running), will the current VPN connection get impacted ?
Yes, assuming that the provider applies the settings.
There are two standard ways to share state between your app and your provider:
-
If the state is transient, use provider messaging. The app calls
sendProviderMessage(_:responseHandler:)and the system callshandleAppMessage(_:completionHandler:)on the provider. -
If you want the state to persist, put it in the
providerConfiguration. If the apps save a configuration while the tunnel is running, the tunnel can learn about this via a KVO observation on itsprotocolConfigurationproperty.
Once your provider learns about the new configuration, it should then call setTunnelNetworkSettings(_:completionHandler:) to apply the state.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"