diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2013-03-15 13:58:38 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2013-03-15 14:35:38 +0900 |
commit | f83d90c6671371c9fb95c7946461795efe5a1da3 (patch) | |
tree | ff58354c89f34c36670db780a921422184ee07d4 | |
parent | 69edd64d9bf839428ce0a7723cd0f1deda98dc0d (diff) | |
download | frameworks_base-f83d90c6671371c9fb95c7946461795efe5a1da3.zip frameworks_base-f83d90c6671371c9fb95c7946461795efe5a1da3.tar.gz frameworks_base-f83d90c6671371c9fb95c7946461795efe5a1da3.tar.bz2 |
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
-rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 5ed23cf..a6ddcab 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -1430,11 +1430,11 @@ public class ConnectivityService extends IConnectivityManager.Stub { private boolean modifyRouteToAddress(LinkProperties lp, InetAddress addr, boolean doAdd, boolean toDefaultTable) { - String iface = lp.getInterfaceName(); - RouteInfo bestRoute = RouteInfo.selectBestRoute(lp.getRoutes(), addr); + RouteInfo bestRoute = RouteInfo.selectBestRoute(lp.getAllRoutes(), addr); if (bestRoute == null) { - bestRoute = RouteInfo.makeHostRoute(addr, iface); + bestRoute = RouteInfo.makeHostRoute(addr, lp.getInterfaceName()); } else { + String iface = bestRoute.getInterface(); if (bestRoute.getGateway().equals(addr)) { // if there is no better route, add the implied hostroute for our gateway 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, boolean toDefaultTable) { - String ifaceName = lp.getInterfaceName(); - if ((ifaceName == null) || (lp == null) || (r == null)) { - if (DBG) log("modifyRoute got unexpected null: " + ifaceName + ", " + lp + ", " + r); + if ((lp == null) || (r == null)) { + if (DBG) log("modifyRoute got unexpected null: " + lp + ", " + r); return false; } @@ -1460,8 +1459,14 @@ public class ConnectivityService extends IConnectivityManager.Stub { return false; } + String ifaceName = r.getInterface(); + if(ifaceName == null) { + loge("Error modifying route - no interface name"); + return 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.getGateway().equals(r.getGateway())) { // 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); dnsDiff = curLp.compareDnses(newLp); } else if (newLp != null) { - routeDiff.added = newLp.getRoutes(); + routeDiff.added = newLp.getAllRoutes(); dnsDiff.added = newLp.getDnses(); } |