Merge "Add support to change IPv6 privacy extensions"

This commit is contained in:
Irfan Sheriff
2011-09-14 15:03:26 -07:00
committed by Android (Google) Code Review
3 changed files with 27 additions and 6 deletions

View File

@@ -73,6 +73,11 @@ interface INetworkManagementService
*/ */
void setInterfaceUp(String iface); void setInterfaceUp(String iface);
/**
* Set interface IPv6 privacy extensions
*/
void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable);
/** /**
* Retrieves the network routes currently configured on the specified * Retrieves the network routes currently configured on the specified
* interface * interface

View File

@@ -480,6 +480,20 @@ public class NetworkManagementService extends INetworkManagementService.Stub
} }
} }
public void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable)
throws IllegalStateException {
String cmd = String.format("interface ipv6privacyextensions %s %s", iface,
enable ? "enable" : "disable");
try {
mConnector.doCommand(cmd);
} catch (NativeDaemonConnectorException e) {
throw new IllegalStateException(
"Unable to communicate with native daemon to set ipv6privacyextensions - " + e);
}
}
/* TODO: This is right now a IPv4 only function. Works for wifi which loses its /* 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 */ IPv6 addresses on interface down, but we need to do full clean up here */
public void clearInterfaceAddresses(String iface) throws IllegalStateException { public void clearInterfaceAddresses(String iface) throws IllegalStateException {

View File

@@ -1917,15 +1917,17 @@ public class WifiStateMachine extends StateMachine {
Log.e(TAG, "Failed to reload STA firmware " + e); Log.e(TAG, "Failed to reload STA firmware " + e);
// continue // continue
} }
//A runtime crash can leave the interface up and try {
//this affects connectivity when supplicant starts up. //A runtime crash can leave the interface up and
//Ensure interface is down before a supplicant start. //this affects connectivity when supplicant starts up.
try { //Ensure interface is down before a supplicant start.
mNwService.setInterfaceDown(mInterfaceName); mNwService.setInterfaceDown(mInterfaceName);
//Set privacy extensions
mNwService.setInterfaceIpv6PrivacyExtensions(mInterfaceName, true);
} catch (RemoteException re) { } catch (RemoteException re) {
if (DBG) Log.w(TAG, "Unable to bring down wlan interface: " + re); if (DBG) Log.w(TAG, "Unable to change interface settings: " + re);
} catch (IllegalStateException ie) { } catch (IllegalStateException ie) {
if (DBG) Log.w(TAG, "Unable to bring down wlan interface: " + ie); if (DBG) Log.w(TAG, "Unable to change interface settings: " + ie);
} }
if(WifiNative.startSupplicant()) { if(WifiNative.startSupplicant()) {