Migrate/restart IKE session with delay upon net update

When the underlying network sees an update of its NetworkCaps
or LinkProperties, the IKE connection needs to try and migrate
because some parameters are deduced from them (e.g., from
NetworkCaps the transport is used to infer the correct encap
type ; from LP the available IP address families are used
(in some cases) to infer the correct source IP to use). It
is therefore necessary to try and migrate or restart the
IKE connection when the relevant changes happen. IP family
changes are especially important but any IP address change may
require migration.

However, starting the migration immediately is both costly
(it is relatively likely another change will happen
immediately – indeed, that's guaranteed when the network
first connect) and racy, because the IKE library might not
yet be aware of changes to the network.

In practice, the call terminates in the IKE library fetching
the NC and LP using the synchronous ConnectivityManager
method. That's unadvisable (and indeed, is likely the cause
of bugs in that library today), but the delay will help
stabilizing getting the correct arguments here. Further, if
the IKE code is ever fixed to use callbacks, this delay
will be instrumental in making sure the IKE code has been
updated in time about the network properties.

Test: VpnTest
Bug: 269715746
Change-Id: Ib8ff5def9ccde2cd579df1281a02ac2095085171
1 file changed