Remove default routes for non-default networks.
Recoding/port of a change that existed in GB but got dropped in the shuffle. bug:5036222 Change-Id: I87e819d255c0c46f3ec8fe0fe18d27ae9df1ae36
This commit is contained in:
@@ -1831,6 +1831,19 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
for (RouteInfo r : routeDiff.added) {
|
for (RouteInfo r : routeDiff.added) {
|
||||||
if (isLinkDefault || ! r.isDefaultRoute()) {
|
if (isLinkDefault || ! r.isDefaultRoute()) {
|
||||||
addRoute(newLp, r);
|
addRoute(newLp, r);
|
||||||
|
} else {
|
||||||
|
// many radios add a default route even when we don't want one.
|
||||||
|
// remove the default route unless somebody else has asked for it
|
||||||
|
String ifaceName = newLp.getInterfaceName();
|
||||||
|
if (TextUtils.isEmpty(ifaceName) == false && mAddedRoutes.contains(r) == false) {
|
||||||
|
if (DBG) log("Removing " + r + " for interface " + ifaceName);
|
||||||
|
try {
|
||||||
|
mNetd.removeRoute(ifaceName, r);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// never crash - catch them all
|
||||||
|
loge("Exception trying to remove a route: " + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user