Loading core/java/android/os/INetworkManagementService.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,16 @@ interface INetworkManagementService */ void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable); /** * Disable IPv6 on an interface */ void disableIpv6(String iface); /** * Enable IPv6 on an interface */ void enableIpv6(String iface); /** * Retrieves the network routes currently configured on the specified * interface Loading services/java/com/android/server/NetworkManagementService.java +22 −0 Original line number Diff line number Diff line Loading @@ -508,6 +508,28 @@ public class NetworkManagementService extends INetworkManagementService.Stub } } public void enableIpv6(String iface) throws IllegalStateException { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService"); try { mConnector.doCommand(String.format("interface ipv6 %s enable", iface)); } catch (NativeDaemonConnectorException e) { throw new IllegalStateException( "Unable to communicate to native daemon for enabling ipv6"); } } public void disableIpv6(String iface) throws IllegalStateException { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService"); try { mConnector.doCommand(String.format("interface ipv6 %s disable", iface)); } catch (NativeDaemonConnectorException e) { throw new IllegalStateException( "Unable to communicate to native daemon for disabling ipv6"); } } public void addRoute(String interfaceName, RouteInfo route) { modifyRoute(interfaceName, ADD, route); } Loading wifi/java/android/net/wifi/WifiStateMachine.java +27 −3 Original line number Diff line number Diff line Loading @@ -1560,8 +1560,9 @@ public class WifiStateMachine extends StateMachine { try { mNwService.clearInterfaceAddresses(mInterfaceName); mNwService.disableIpv6(mInterfaceName); } catch (Exception e) { Log.e(TAG, "Failed to clear IP addresses on disconnect" + e); Log.e(TAG, "Failed to clear addresses or disable ipv6" + e); } /* Reset data structures */ Loading Loading @@ -1841,6 +1842,21 @@ public class WifiStateMachine extends StateMachine { mWifiP2pManager = (WifiP2pManager) mContext.getSystemService(Context.WIFI_P2P_SERVICE); mWifiP2pChannel.connect(mContext, getHandler(), mWifiP2pManager.getMessenger()); /* IPv6 is disabled at boot time and is controlled by framework * to be enabled only as long as we are connected to an access point * * This fixes issues, a few being: * - IPv6 addresses and routes stick around after disconnection * - When connected, the kernel is unaware and can fail to start IPv6 negotiation * - The kernel sometimes starts autoconfiguration when 802.1x is not complete */ try { mNwService.disableIpv6(mInterfaceName); } catch (RemoteException re) { Log.e(TAG, "Failed to disable IPv6: " + re); } catch (IllegalStateException e) { Log.e(TAG, "Failed to disable IPv6: " + e); } } } Loading Loading @@ -2734,6 +2750,14 @@ public class WifiStateMachine extends StateMachine { if (DBG) Log.d(TAG, getName() + "\n"); EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); try { mNwService.enableIpv6(mInterfaceName); } catch (RemoteException re) { Log.e(TAG, "Failed to enable IPv6: " + re); } catch (IllegalStateException e) { Log.e(TAG, "Failed to enable IPv6: " + e); } if (!WifiConfigStore.isUsingStaticIp(mLastNetworkId)) { //start DHCP mDhcpStateMachine = DhcpStateMachine.makeDhcpStateMachine( Loading Loading
core/java/android/os/INetworkManagementService.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,16 @@ interface INetworkManagementService */ void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable); /** * Disable IPv6 on an interface */ void disableIpv6(String iface); /** * Enable IPv6 on an interface */ void enableIpv6(String iface); /** * Retrieves the network routes currently configured on the specified * interface Loading
services/java/com/android/server/NetworkManagementService.java +22 −0 Original line number Diff line number Diff line Loading @@ -508,6 +508,28 @@ public class NetworkManagementService extends INetworkManagementService.Stub } } public void enableIpv6(String iface) throws IllegalStateException { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService"); try { mConnector.doCommand(String.format("interface ipv6 %s enable", iface)); } catch (NativeDaemonConnectorException e) { throw new IllegalStateException( "Unable to communicate to native daemon for enabling ipv6"); } } public void disableIpv6(String iface) throws IllegalStateException { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService"); try { mConnector.doCommand(String.format("interface ipv6 %s disable", iface)); } catch (NativeDaemonConnectorException e) { throw new IllegalStateException( "Unable to communicate to native daemon for disabling ipv6"); } } public void addRoute(String interfaceName, RouteInfo route) { modifyRoute(interfaceName, ADD, route); } Loading
wifi/java/android/net/wifi/WifiStateMachine.java +27 −3 Original line number Diff line number Diff line Loading @@ -1560,8 +1560,9 @@ public class WifiStateMachine extends StateMachine { try { mNwService.clearInterfaceAddresses(mInterfaceName); mNwService.disableIpv6(mInterfaceName); } catch (Exception e) { Log.e(TAG, "Failed to clear IP addresses on disconnect" + e); Log.e(TAG, "Failed to clear addresses or disable ipv6" + e); } /* Reset data structures */ Loading Loading @@ -1841,6 +1842,21 @@ public class WifiStateMachine extends StateMachine { mWifiP2pManager = (WifiP2pManager) mContext.getSystemService(Context.WIFI_P2P_SERVICE); mWifiP2pChannel.connect(mContext, getHandler(), mWifiP2pManager.getMessenger()); /* IPv6 is disabled at boot time and is controlled by framework * to be enabled only as long as we are connected to an access point * * This fixes issues, a few being: * - IPv6 addresses and routes stick around after disconnection * - When connected, the kernel is unaware and can fail to start IPv6 negotiation * - The kernel sometimes starts autoconfiguration when 802.1x is not complete */ try { mNwService.disableIpv6(mInterfaceName); } catch (RemoteException re) { Log.e(TAG, "Failed to disable IPv6: " + re); } catch (IllegalStateException e) { Log.e(TAG, "Failed to disable IPv6: " + e); } } } Loading Loading @@ -2734,6 +2750,14 @@ public class WifiStateMachine extends StateMachine { if (DBG) Log.d(TAG, getName() + "\n"); EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); try { mNwService.enableIpv6(mInterfaceName); } catch (RemoteException re) { Log.e(TAG, "Failed to enable IPv6: " + re); } catch (IllegalStateException e) { Log.e(TAG, "Failed to enable IPv6: " + e); } if (!WifiConfigStore.isUsingStaticIp(mLastNetworkId)) { //start DHCP mDhcpStateMachine = DhcpStateMachine.makeDhcpStateMachine( Loading