Add support to change IPv6 privacy extensions

Bug: 3360737
Change-Id: I9136992d05f7abf15bdfd92aad3a3e0c0fe3bee2
This commit is contained in:
Irfan Sheriff
2011-09-14 12:31:56 -07:00
parent 651cdfcbac
commit 7329361cdc
3 changed files with 27 additions and 6 deletions

View File

@@ -73,6 +73,11 @@ interface INetworkManagementService
*/
void setInterfaceUp(String iface);
/**
* Set interface IPv6 privacy extensions
*/
void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable);
/**
* Retrieves the network routes currently configured on the specified
* 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
IPv6 addresses on interface down, but we need to do full clean up here */
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);
// continue
}
//A runtime crash can leave the interface up and
//this affects connectivity when supplicant starts up.
//Ensure interface is down before a supplicant start.
try {
try {
//A runtime crash can leave the interface up and
//this affects connectivity when supplicant starts up.
//Ensure interface is down before a supplicant start.
mNwService.setInterfaceDown(mInterfaceName);
//Set privacy extensions
mNwService.setInterfaceIpv6PrivacyExtensions(mInterfaceName, true);
} 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) {
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()) {