Is there a way to programmatically disable on-demand feature within
packet tunnel provide?
No.
I agree that the system should do a better job about protecting the user from this, and I encourage you to file a bug along those lines. Please post your bug number, just for the record.
However…
Most folks who hit this problem have set up a very broad on-demand rules because they’re trying to use a packet tunnel provider for something other than acting as a VPN. This is yet another example of the “weird and wonderful” problems that I mentioned here.
On the workaround front, you could have your provider keep a persistent record of when it’s launched and when it has successfully connected. If it’s launched without successfully connecting many time over a short period, it could go into a ‘safe’ mode where it immediately fails any connection attempt. That safe mode should run very little code, and thus it’ll minimise the chances of it crashing again.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"