Skip to content

Commit 7329361

Browse files
committed
Add support to change IPv6 privacy extensions
Bug: 3360737 Change-Id: I9136992d05f7abf15bdfd92aad3a3e0c0fe3bee2
1 parent 651cdfc commit 7329361

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

core/java/android/os/INetworkManagementService.aidl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ interface INetworkManagementService
7373
*/
7474
void setInterfaceUp(String iface);
7575

76+
/**
77+
* Set interface IPv6 privacy extensions
78+
*/
79+
void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable);
80+
7681
/**
7782
* Retrieves the network routes currently configured on the specified
7883
* interface

services/java/com/android/server/NetworkManagementService.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,20 @@ public void setInterfaceUp(String iface) throws IllegalStateException {
480480
}
481481
}
482482

483+
public void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable)
484+
throws IllegalStateException {
485+
String cmd = String.format("interface ipv6privacyextensions %s %s", iface,
486+
enable ? "enable" : "disable");
487+
try {
488+
mConnector.doCommand(cmd);
489+
} catch (NativeDaemonConnectorException e) {
490+
throw new IllegalStateException(
491+
"Unable to communicate with native daemon to set ipv6privacyextensions - " + e);
492+
}
493+
}
494+
495+
496+
483497
/* TODO: This is right now a IPv4 only function. Works for wifi which loses its
484498
IPv6 addresses on interface down, but we need to do full clean up here */
485499
public void clearInterfaceAddresses(String iface) throws IllegalStateException {

wifi/java/android/net/wifi/WifiStateMachine.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,15 +1917,17 @@ public boolean processMessage(Message message) {
19171917
Log.e(TAG, "Failed to reload STA firmware " + e);
19181918
// continue
19191919
}
1920-
//A runtime crash can leave the interface up and
1921-
//this affects connectivity when supplicant starts up.
1922-
//Ensure interface is down before a supplicant start.
1923-
try {
1920+
try {
1921+
//A runtime crash can leave the interface up and
1922+
//this affects connectivity when supplicant starts up.
1923+
//Ensure interface is down before a supplicant start.
19241924
mNwService.setInterfaceDown(mInterfaceName);
1925+
//Set privacy extensions
1926+
mNwService.setInterfaceIpv6PrivacyExtensions(mInterfaceName, true);
19251927
} catch (RemoteException re) {
1926-
if (DBG) Log.w(TAG, "Unable to bring down wlan interface: " + re);
1928+
if (DBG) Log.w(TAG, "Unable to change interface settings: " + re);
19271929
} catch (IllegalStateException ie) {
1928-
if (DBG) Log.w(TAG, "Unable to bring down wlan interface: " + ie);
1930+
if (DBG) Log.w(TAG, "Unable to change interface settings: " + ie);
19291931
}
19301932

19311933
if(WifiNative.startSupplicant()) {

0 commit comments

Comments
 (0)