We have a PakcetTunnelProvider in SystemExtension with split tunnelling. We are setting up a private range of IP address (240.0.0.1/10) as include routes and a few match domains using NEPacketTunnelNetworkSettings. Everything works fine. We are able to setup tunnel settings and receive DNS as well as data traffic as per our rules.
However, when we execute the netstat -rn -f inet
command in Terminal, it shows the following output:
240.0.0/10 link#8 UCS utun0
240.0.0.1 10.211.55.1 UGHS en0
240.0.0.2 10.211.55.1 UGHS en0
240.0.0.3 link#8 UHWIi utun0
After stopping the tunnel, some stale entries remain in the route table, as evidenced by the output of netstat -rn -f inet
:
240.0.0/10 link#8 UCS utun0
240.0.0.3 link#8 UHWIi utun0
The expected behavior is that included routes should automatically clear once the tunnel stops.
** It's noteworthy that we've only observed this behaviour on Monterey OS; **
it works as expected on Ventura and Sonoma (where routes are automatically removed upon tunnel cessation)
We have tried to set the tunnel settings to nil
explicitly, but no luck.
setTunnelNetworkSettings(nil) { _ in}
We're unsure why the routes aren't clearing properly on Monterey OS.
Thanks -
Happy questioning