I've implemented a custom VPN for macOS (system extension, Packet Tunnel Provider). I've configured disconnectOnSleep = false, and at the Provider I've implemented the sleep() and wake() functions.
At the wake() func, I'm trying to re-establish the connection, and most of the time it's working well.
However, there are times when even after wake() is called, it seems that the interfaces aren't ready/available, and I'm getting "Network is unreachable" errors (I'm working with BSD Sockets).
- Any idea why the interfaces aren't available at this point, after wake() had been called?
- Any idea on how to be updated when the interfaces are available?
For a temp solution, do you think that using something like Reachability at the extension would help me know when the interface is available?
I would avoid Reachability for any solution, even a temp one. As a way to bootstrap your nw_connection_t
migration you could start up a connection from there and wait until it goes into the ready
state to take action.