Clear IPv4 address on tethering teardown.
Test: as follows
- built
- flashed
- booted
- runtest frameworks-net passes
- wlan0 in STA mode, wlan1 up/down in AP mode
no lingering IPv4 mode
- USB tethering up/down works
- bluetooth tethering yields:
05-18 17:50:49.726 719 756 D TetherController: untetherInterface(bt-pan)
05-18 17:50:49.729 1194 1230 E Tethering: [bt-pan] ERROR Failed to clear IPv4 address on interface bt-pan: java.lang.IllegalStateException: command '224 interface setcfg bt-pan 0.0.0.0 0' failed with '400 224 Failed to clear address (No such device)'
which is acceptable (no actual crash, just a log message)
Bug: 79905644
Change-Id: Iaf29788a6692d810f3160e3f21d06b7452ecbaa6
diff --git a/tests/net/java/com/android/server/connectivity/TetheringTest.java b/tests/net/java/com/android/server/connectivity/TetheringTest.java
index d643c69..f0f3f2c 100644
--- a/tests/net/java/com/android/server/connectivity/TetheringTest.java
+++ b/tests/net/java/com/android/server/connectivity/TetheringTest.java
@@ -775,11 +775,12 @@
sendWifiApStateChanged(WIFI_AP_STATE_ENABLED, TEST_WLAN_IFNAME, IFACE_IP_MODE_TETHERED);
mLooper.dispatchAll();
- // We verify get/set called twice here: once for setup and once during
+ // We verify get/set called thrice here: once for setup and twice during
// teardown because all events happen over the course of the single
- // dispatchAll() above.
+ // dispatchAll() above. Note that once the TISM IPv4 address config
+ // code is refactored the two calls during shutdown will revert to one.
verify(mNMService, times(2)).getInterfaceConfig(TEST_WLAN_IFNAME);
- verify(mNMService, times(2))
+ verify(mNMService, times(3))
.setInterfaceConfig(eq(TEST_WLAN_IFNAME), any(InterfaceConfiguration.class));
verify(mNMService, times(1)).tetherInterface(TEST_WLAN_IFNAME);
verify(mWifiManager).updateInterfaceIpState(