7b0732fff7832e438b8609c9bc6fe1ee0f6ca2a6
Currently, NetworkAgentInfo keeps a Nat464Xlat object only on networks where we're starting clatd (i.e., IPv6-only networks). Simplify this code by making the Nat464Xlat object final and always non-null. This allows us to use Nat464Xlat to store information, such as the NAT64 prefix, even if the clat daemon has not been started yet. Also, remove the STOPPING state which waits for the interface to be removed. Instead, when stop() is called, immediately enter the IDLE state. - This is necessary in order to be able to call start() again before the interface removal notification has arrived. - It's also arguably more correct than the current code, because when stop() returns clatd has already terminated (ClatdController::stopClatd calls waitpid), and thus the tun fd is already closed and the tun interface is gone. Also, now that Nat464Xlat objects are reused after stop(), add test coverage for calling start() after stop, in both cases: - The notification that the previous interface was removed arrives before the second start(). - The notification that the previous interface was removed arrives after the second start() but before the notification that the second interface was added. Also fix a couple of lint warnings. Test: builds, boots Test: atest FrameworksNetTests Test: clatd stops when IPv4 address added Test: clatd restarts after "adb shell killall clatd" Change-Id: I3dc66d155aa27606681f3473daf2170434d8c6d0
Description
android_packages_modules_Connectivity
Languages
Java
81.4%
Kotlin
7.7%
AIDL
4.5%
C++
4.5%
C
1.7%
Other
0.1%