We have a packettunnelprovider which we are using for intercepting IP packets. We define includeroutes while setting tunnel using 'setTunnelNetworkSettings'.
But later when we want to disable packet interception, we want to do it from packettunnelprovider extension itself by reseting tunnel settings, for which we set 'NETunnelNetworkSettings' to nil in setTunnelNetworkSettings call. This deletes most of the routes added by includeroutes but few are always left out.
% ifconfig utun3
utun3: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1300
options=6463<RXCSUM,TXCSUM,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
% netstat -rn -f inet | grep utun3
11.99/24 link#25 UCS utun3
269.254 link#25 UCS utun3
192.168.0 link#25 UCS utun3
Code which we use to reset packet tunnel:
[g_PacketTunnelProvider setTunnelNetworkSettings:nil completionHandler:^(NSError * _Nullable errorNE) {
if (errorNE != nil) {
// handle error
} else {
// handle success
}
}];
Can you please help in what could be the reason behind it?
Note: I am aware that VPN can be disabled from provider app, but I want to handle this in packettunnelprovider extension by resetting 'NETunnelNetworkSettings'.
Please suggest if there is any way we can handle it inside provider extension itself.
I don’t see any way to do that, other than by doing what you’re already doing, calling -setTunnelNetworkSettings:completionHandler:
, which doesn’t work )-: That seems bugworthy to me. Please post your bug number, just for the record.
Another potential option would be to force the tunnel down from your provider by calling -cancelTunnelWithError:
.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"