Merge "Always specify an interface for host routes." into jb-mr2-dev

This commit is contained in:
Lorenzo Colitti
2013-03-11 17:22:25 +00:00
committed by Android (Google) Code Review
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);
}
}