Always specify an interface for host routes.

Change-Id: I05b4d87e7d7e8237c6f4a70f1fedae00f416f581
This commit is contained in:
Lorenzo Colitti
2013-03-08 12:30:44 -08:00
parent 73b9785a15
commit 7a43b0f7cf
3 changed files with 23 additions and 16 deletions

View File

@@ -117,17 +117,17 @@ public class RouteInfo implements Parcelable {
this(host, null, null);
}
public static RouteInfo makeHostRoute(InetAddress host) {
return makeHostRoute(host, null);
public static RouteInfo makeHostRoute(InetAddress host, String iface) {
return makeHostRoute(host, null, iface);
}
public static RouteInfo makeHostRoute(InetAddress host, InetAddress gateway) {
public static RouteInfo makeHostRoute(InetAddress host, InetAddress gateway, String iface) {
if (host == null) return null;
if (host instanceof Inet4Address) {
return new RouteInfo(new LinkAddress(host, 32), gateway);
return new RouteInfo(new LinkAddress(host, 32), gateway, iface);
} else {
return new RouteInfo(new LinkAddress(host, 128), gateway);
return new RouteInfo(new LinkAddress(host, 128), gateway, iface);
}
}