From 086779de1125bc4a0f44220cf8c56e5d5521862d Mon Sep 17 00:00:00 2001 From: Jimmy Chen Date: Thu, 7 Mar 2019 14:15:36 +0800 Subject: [PATCH] IPv6: enable IPv6 link local routing for local network IPv6 link local is an automatically configured address. The routing should be activated regardless of the DHCP service. Bug: 126063997 Test: Unit tests - atest FrameworksNetTests Test: Unit tests - atest FrameworksWifiTests Test: * DUT1 enables hotspot * DUT2 associates to DUT1 * use ping6 to verify the local link on both side Test: * DUT1 creates a P2P group * DUT2 joins this group as a legacy client * use ping6 to verify the local link on both side Change-Id: I102bf29e8da14808097e43c840d74d41b6b3758f --- .../com/android/server/NetworkManagementService.java | 4 ++++ services/net/java/android/net/ip/IpServer.java | 11 ----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java index a4fda8e9f57b1..a9645c419108a 100644 --- a/services/core/java/com/android/server/NetworkManagementService.java +++ b/services/core/java/com/android/server/NetworkManagementService.java @@ -2506,6 +2506,10 @@ public class NetworkManagementService extends INetworkManagementService.Stub modifyRoute(MODIFY_OPERATION_ADD, INetd.LOCAL_NET_ID, route); } } + + // IPv6 link local should be activated always. + modifyRoute(MODIFY_OPERATION_ADD, INetd.LOCAL_NET_ID, + new RouteInfo(new IpPrefix("fe80::/64"), null, iface)); } @Override diff --git a/services/net/java/android/net/ip/IpServer.java b/services/net/java/android/net/ip/IpServer.java index 34fc7354d63ef..0e44f88d23896 100644 --- a/services/net/java/android/net/ip/IpServer.java +++ b/services/net/java/android/net/ip/IpServer.java @@ -87,7 +87,6 @@ public class IpServer extends StateMachine { return "UNKNOWN: " + state; } - private static final IpPrefix LINK_LOCAL_PREFIX = new IpPrefix("fe80::/64"); private static final byte DOUG_ADAMS = (byte) 42; private static final String USB_NEAR_IFACE_ADDR = "192.168.42.129"; @@ -557,16 +556,6 @@ public class IpServer extends StateMachine { addedPrefixes.removeAll(mLastRaParams.prefixes); } - if (mLastRaParams == null || mLastRaParams.prefixes.isEmpty()) { - // We need to be able to send unicast RAs, and clients might - // like to ping the default router's link-local address. Note - // that we never remove the link-local route from the network - // until Tethering disables tethering on the interface. We - // only need to add the link-local prefix once, but in the - // event we add it more than once netd silently ignores EEXIST. - addedPrefixes.add(LINK_LOCAL_PREFIX); - } - if (!addedPrefixes.isEmpty()) { final ArrayList toBeAdded = getLocalRoutesFor(mIfaceName, addedPrefixes);