Merge "Always add local subnet routes to the interface's routing table" am: 981228be38

am: 5fb26a1270

Change-Id: I3e0aa03b46b77bd65aa301fec28f4f6ab5de5c62
This commit is contained in:
Rubin Xu
2017-09-07 12:38:56 +00:00
committed by android-build-merger
4 changed files with 170 additions and 8 deletions

View File

@@ -18,14 +18,13 @@ package android.net;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.ProxyInfo;
import android.os.Parcelable;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import java.net.InetAddress;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
@@ -503,12 +502,23 @@ public final class LinkProperties implements Parcelable {
return Collections.unmodifiableList(mRoutes);
}
/**
* Make sure this LinkProperties instance contains routes that cover the local subnet
* of its link addresses. Add any route that is missing.
* @hide
*/
public void ensureDirectlyConnectedRoutes() {
for (LinkAddress addr: mLinkAddresses) {
addRoute(new RouteInfo(addr, null, mIfaceName));
}
}
/**
* Returns all the routes on this link and all the links stacked above it.
* @hide
*/
public List<RouteInfo> getAllRoutes() {
List<RouteInfo> routes = new ArrayList();
List<RouteInfo> routes = new ArrayList<>();
routes.addAll(mRoutes);
for (LinkProperties stacked: mStackedLinks.values()) {
routes.addAll(stacked.getAllRoutes());