Set routes from stacked links as well.
Currently, ConnectivityService adds and removes routes to/from the routing table only based on the LinkProperties's routes. Make it update routes based on the stacked links as well. Bug: 8276725 Change-Id: I9a2adf537af5a04de0aaab3780afbcc3bb5c6acb
This commit is contained in:
@@ -1430,11 +1430,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
|
|
||||||
private boolean modifyRouteToAddress(LinkProperties lp, InetAddress addr, boolean doAdd,
|
private boolean modifyRouteToAddress(LinkProperties lp, InetAddress addr, boolean doAdd,
|
||||||
boolean toDefaultTable) {
|
boolean toDefaultTable) {
|
||||||
String iface = lp.getInterfaceName();
|
RouteInfo bestRoute = RouteInfo.selectBestRoute(lp.getAllRoutes(), addr);
|
||||||
RouteInfo bestRoute = RouteInfo.selectBestRoute(lp.getRoutes(), addr);
|
|
||||||
if (bestRoute == null) {
|
if (bestRoute == null) {
|
||||||
bestRoute = RouteInfo.makeHostRoute(addr, iface);
|
bestRoute = RouteInfo.makeHostRoute(addr, lp.getInterfaceName());
|
||||||
} else {
|
} else {
|
||||||
|
String iface = bestRoute.getInterface();
|
||||||
if (bestRoute.getGateway().equals(addr)) {
|
if (bestRoute.getGateway().equals(addr)) {
|
||||||
// if there is no better route, add the implied hostroute for our gateway
|
// if there is no better route, add the implied hostroute for our gateway
|
||||||
bestRoute = RouteInfo.makeHostRoute(addr, iface);
|
bestRoute = RouteInfo.makeHostRoute(addr, iface);
|
||||||
@@ -1449,9 +1449,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
|
|
||||||
private boolean modifyRoute(LinkProperties lp, RouteInfo r, int cycleCount, boolean doAdd,
|
private boolean modifyRoute(LinkProperties lp, RouteInfo r, int cycleCount, boolean doAdd,
|
||||||
boolean toDefaultTable) {
|
boolean toDefaultTable) {
|
||||||
String ifaceName = lp.getInterfaceName();
|
if ((lp == null) || (r == null)) {
|
||||||
if ((ifaceName == null) || (lp == null) || (r == null)) {
|
if (DBG) log("modifyRoute got unexpected null: " + lp + ", " + r);
|
||||||
if (DBG) log("modifyRoute got unexpected null: " + ifaceName + ", " + lp + ", " + r);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1460,8 +1459,14 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String ifaceName = r.getInterface();
|
||||||
|
if(ifaceName == null) {
|
||||||
|
loge("Error modifying route - no interface name");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.isHostRoute() == false) {
|
if (r.isHostRoute() == false) {
|
||||||
RouteInfo bestRoute = RouteInfo.selectBestRoute(lp.getRoutes(), r.getGateway());
|
RouteInfo bestRoute = RouteInfo.selectBestRoute(lp.getAllRoutes(), r.getGateway());
|
||||||
if (bestRoute != null) {
|
if (bestRoute != null) {
|
||||||
if (bestRoute.getGateway().equals(r.getGateway())) {
|
if (bestRoute.getGateway().equals(r.getGateway())) {
|
||||||
// if there is no better route, add the implied hostroute for our gateway
|
// if there is no better route, add the implied hostroute for our gateway
|
||||||
@@ -2300,7 +2305,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
routeDiff = curLp.compareRoutes(newLp);
|
routeDiff = curLp.compareRoutes(newLp);
|
||||||
dnsDiff = curLp.compareDnses(newLp);
|
dnsDiff = curLp.compareDnses(newLp);
|
||||||
} else if (newLp != null) {
|
} else if (newLp != null) {
|
||||||
routeDiff.added = newLp.getRoutes();
|
routeDiff.added = newLp.getAllRoutes();
|
||||||
dnsDiff.added = newLp.getDnses();
|
dnsDiff.added = newLp.getDnses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user