PacketTunnelProvider does not capture packet from Personal Hotspot

Hi,


I have packet tunnel provider on iOS 9.3.1 with default routes


let defaultRoute = NEIPv4Route.defaultRoute()


It work perfectly, however when i have another device that connect to my iOS with personal hotspot.


For some reason, the data that being processed does not passing through my VPN client, it seem it go through my 3G interface. It is weird cause my 3G interface goes through my packet tunnel provider.

I also add local route for 172.16.0.0 cause hotspot using that address range.


let localHotspotRoute = NEIPv4Route.init(destinationAddress: "172.16.0.0", subnetMask: "255.240.0.0")

newSettings.IPv4Settings?.includedRoutes = [defaultRoute,localRoute,localHotspotRoute]


This is also does not work.


Is there any setting that I can use, so that my packet tunnel provider work as default gateway on my iOS device ?


Regards


Adrian

Most iOS devices with WWAN have more than one logical WWAN interface. If you dump the interface list using

getifaddrs
, you’ll see a bunch of logical WWAN interfaces (
pdp_ip0
,
pdp_ip1
, and so on). The names and dispositions of these are complex, undocumented, and vary by WWAN provider, but my guess is that Personal Hotspot on your device has specifically bound to an alternative interface and thus ignores the default route that your packet tunnel provider has set up.

This is not different from, say, an app that specifically binds to Wi-Fi. There’s no guarantee that packet tunnel providers will see all traffic on the system.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Is there any way to make sure the traffic will go via the VPN app ?

Is there any way to make sure the traffic will go via the VPN app ?

Not that I’m aware of. Personal Hotspot certainly has no configuration options that can help here. And in the packet tunnel provider space all you can do is become the default route.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

OK, thanks again eskimo

PacketTunnelProvider does not capture packet from Personal Hotspot
 
 
Q