Thank you for the reply Matt.Using the solution provided by you and Quinn, I can now successfully package a Daemon with a Provisioning Profile.A process without a UI component is not sufficient for NetworkExtension bringup. However I found out that this can be achieved by running the app in background using open command with -gj flags.Thank you.
Thank you for the response Eskimo!I dont have a routing problem. PacketTunnelProvider is working as expected.
Thank you for the reply eskimo!That made it work. I am able to read packets now. But I see there is a default route that is always created even if there is no route configured in the PacketTunnelProvider,Here is the output of my "netstat -nr" command:Internet:
Destination Gateway Flags Netif Expire
default 192.168.1.1 UGSc en0
default link#18 UCSI utun2 Is the entry at line #4 supposed to be present even if no default route is configured over the utun interface?Thank you.
Here is my code snippet,setTunnelNetworkSettings(networkSettings, completionHandler: { (error) -> Void in
if (error != nil) {
NSLog("Failed to apply network settings: \(String(describing: error))")
completionHandler(error)
} else {
NSLog("Successfully applied network settings")
completionHandler(error)
//Read packets from the interface
let packetFlow = NEPacketTunnelFlow()
packetFlow.readPackets(completionHandler: {packets_array, protocols_array in
NSLog("Packets read from virtual interface, packets_array: \(packets_array.count), protocol_array has: \(protocols_array.count) entries")
})
//Read packets done
}
})In order to test this flow, I start the traffic first and then bring up my application. But I am not able to read any packets from the virtual interface. This is what I see in the logs:Packets read from virtual interface, packets_array: 0, protocol_array has: 0 entriesCan someone please let me know if I am missing something here?Thank you.