Ensure interface down before wpa_supplicant start
Now that the driver is built into the kernel, a runtime crash
followed by a driver unload and reload does not reset the interface.
Ensure interface is down before bringing up supplicant
Bug: 5032635
Change-Id: Ib8f3d47617e587139a8a91a82146ee3a2f329700
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 4b7256a..782e7d7 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -446,6 +446,28 @@
}
}
+ public void setInterfaceDown(String iface) throws IllegalStateException {
+ try {
+ InterfaceConfiguration ifcg = getInterfaceConfig(iface);
+ ifcg.interfaceFlags = ifcg.interfaceFlags.replace("up", "down");
+ setInterfaceConfig(iface, ifcg);
+ } catch (NativeDaemonConnectorException e) {
+ throw new IllegalStateException(
+ "Unable to communicate with native daemon for interface down - " + e);
+ }
+ }
+
+ public void setInterfaceUp(String iface) throws IllegalStateException {
+ try {
+ InterfaceConfiguration ifcg = getInterfaceConfig(iface);
+ ifcg.interfaceFlags = ifcg.interfaceFlags.replace("down", "up");
+ setInterfaceConfig(iface, ifcg);
+ } catch (NativeDaemonConnectorException e) {
+ throw new IllegalStateException(
+ "Unable to communicate with native daemon for interface up - " + e);
+ }
+ }
+
/* TODO: This is right now a IPv4 only function. Works for wifi which loses its
IPv6 addresses on interface down, but we need to do full clean up here */
public void clearInterfaceAddresses(String iface) throws IllegalStateException {