IPv6: allow the same prefix routing entries for link local
Allowing creating multiple link-local routes in the same table, so we can make IPv6
work on all interfaces in the local_network table.
Bug: 126063997
Test: * enable hotspot & usb tethering
* use ping6 to verify link local in both side of hotspot/usb
tethering
Change-Id: Ibe897004bd72bc88744c4bbac44ca512c0482f3b
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index ad6f6a6..d0ceefa 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -418,6 +418,13 @@
};
uint16_t flags = (action == RTM_NEWROUTE) ? NETLINK_ROUTE_CREATE_FLAGS : NETLINK_REQUEST_FLAGS;
+
+ // Allow creating multiple link-local routes in the same table, so we can make IPv6
+ // work on all interfaces in the local_network table.
+ if (family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(reinterpret_cast<in6_addr*>(rawAddress))) {
+ flags &= ~NLM_F_EXCL;
+ }
+
int ret = sendNetlinkRequest(action, flags, iov, ARRAY_SIZE(iov), nullptr);
if (ret) {
ALOGE("Error %s route %s -> %s %s to table %u: %s",