Immediately create native networks when NetworkAgents register.
Currently, native networks for non-VPN networks are created only
when the NetworkAgent goes into the CONNECTED state. This is not
ideal, because until the network is connected:
- Nothing routes to the network, so no IP packets can be sent on
it (except via packet sockets).
- Many network configuration changes (e.g., routes and DNS
servers) fail to apply because the network does not exist yet.
These cause ENONET errors in the logs.
Fix this starting in U by creating the native network as soon as
the agent registers. This should not impact apps because
NetworkCallbacks are not sent until networks are connected.
Bug: 143158421
Test: new coverage in NetworkAgentTest
Change-Id: I26bfa8630c085422175558645c47a6c64be96ae6
3 files changed