NEPacketTunnelProvider dns request packets are not going out if include rules having all IPv4 network traffic be routed

Hi,

We have following settings for NEPacketTunnelProvider with include rules having all IPv4 network traffic be routed. Exclude rule having 8.8.8.8 & 10.212.24.222. In this case dns request packets are not going out.

let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "xxxxx")
 settings.ipv4Settings = NEIPv4Settings(addresses: ["10.10.10.10"], subnetMasks: ["255.255.255.255"])
 
settings.ipv4Settings?.includedRoutes = [NEIPv4Route(destinationAddress: "0.0.0.0", subnetMask: "0.0.0.0")]

or the below one
settings.ipv4Settings?.includedRoutes = [NEIPv4Route.default()]

settings.ipv4Settings?.excludedRoutes = [
NEIPv4Route(destinationAddress: "8.8.8.8", subnetMask: "255.255.255.255"), 
NEIPv4Route(destinationAddress: "10.212.24.222", subnetMask: "255.255.255.255")]

settings.mtu = 1500

If we are changing tunnel settings as below, then dns request packets are coming out in pcap dumps.

settings.ipv4Settings?.includedRoutes = [
            NEIPv4Route(destinationAddress: "10.0.0.0", subnetMask: "255.0.0.0"),
            NEIPv4Route(destinationAddress: "8.0.0.0", subnetMask: "255.0.0.0")
        ]

settings.ipv4Settings?.excludedRoutes = [
NEIPv4Route(destinationAddress: "8.8.8.8", subnetMask: "255.255.255.255"), 
NEIPv4Route(destinationAddress: "10.212.24.222", subnetMask: "255.255.255.255")]

Why the former 0.0.0.0 / defaultcase not working? How to include all traffic be routed in packet tunnel by excluding selective traffic?

Hi,

Following include setting working. But i am not sure below setting in place of ipv4Settings 0.0.0.0 or default will have any serious drawbacks.

settings.ipv4Settings?.includedRoutes = [
            NEIPv4Route(destinationAddress: "0.0.0.0", subnetMask: "128.0.0.0"),
            NEIPv4Route(destinationAddress: "128.0.0.0", subnetMask: "128.0.0.0")
        ]

//DNS 8.8.8.8, 10.212.24.222
settings.ipv4Settings?.excludedRoutes = [
NEIPv4Route(destinationAddress: "8.8.8.8", subnetMask: "255.255.255.255"), 
NEIPv4Route(destinationAddress: "10.212.24.222", subnetMask: "255.255.255.255")]
NEPacketTunnelProvider dns request packets are not going out if include rules having all IPv4 network traffic be routed
 
 
Q