iOS 12.2 ipv4Settings.excludedRoutes not work in cellular networking

I developed a DNS-over-HTTPS client for iOS. It setup a full-tunnel mode with exclude all network(except my VPN interface subnet) to enable the resolver for all interface, and other traffic should pass through physical interface. The code run well in a 12.1.4 iPhone and a 12.2 iPhone with wifi connection. But 12.2 iPhone with cellular connection, all ip packet pass through VPN interface.


My code:


let VPN_INTERFACE = "203.0.113.1"

let VPN_NETWORK = "203.0.113.0"

let VPN_MASK = "255.255.255.0"

let VPN_DNS = "203.0.113.3"

let VPN_EXCLUDEDROUTES = [

NEIPv4Route(destinationAddress: "64.0.0.0", subnetMask: "192.0.0.0"),

NEIPv4Route(destinationAddress: "32.0.0.0", subnetMask: "224.0.0.0"),

NEIPv4Route(destinationAddress: "16.0.0.0", subnetMask: "240.0.0.0"),

NEIPv4Route(destinationAddress: "8.0.0.0", subnetMask: "248.0.0.0"),

NEIPv4Route(destinationAddress: "4.0.0.0", subnetMask: "252.0.0.0"),

......

NEIPv4Route(destinationAddress: "203.0.112.0", subnetMask: "255.255.255.0")

]

let ipv4Settings = NEIPv4Settings(addresses: [VPN_INTERFACE], subnetMasks: [VPN_MASK])

ipv4Settings.includedRoutes = [NEIPv4Route.default()]

ipv4Settings.excludedRoutes = VPN_EXCLUDEDROUTES

...


Is anyone get the same problem? My cellular carrier is china telecom, Beijing.

Replies

forget it. I upgrade to iOS 12.4 then this problem disappear