Merge "Routing workaround." into jb-mr2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b7e6a4433b
@ -2347,28 +2347,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
for (RouteInfo r : routeDiff.added) {
|
||||
if (isLinkDefault || ! r.isDefaultRoute()) {
|
||||
addRoute(newLp, r, TO_DEFAULT_TABLE);
|
||||
} else {
|
||||
// add to a secondary route table
|
||||
addRoute(newLp, r, TO_SECONDARY_TABLE);
|
||||
|
||||
// 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 (VDBG) log("Removing " + r + " for interface " + ifaceName);
|
||||
try {
|
||||
mNetd.removeRoute(ifaceName, r);
|
||||
} catch (Exception e) {
|
||||
// never crash - catch them all
|
||||
if (DBG) loge("Exception trying to remove a route: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isLinkDefault) {
|
||||
// handle DNS routes
|
||||
if (routesChanged) {
|
||||
@ -2393,6 +2371,29 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (RouteInfo r : routeDiff.added) {
|
||||
if (isLinkDefault || ! r.isDefaultRoute()) {
|
||||
addRoute(newLp, r, TO_DEFAULT_TABLE);
|
||||
} else {
|
||||
// add to a secondary route table
|
||||
addRoute(newLp, r, TO_SECONDARY_TABLE);
|
||||
|
||||
// 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 (VDBG) log("Removing " + r + " for interface " + ifaceName);
|
||||
try {
|
||||
mNetd.removeRoute(ifaceName, r);
|
||||
} catch (Exception e) {
|
||||
// never crash - catch them all
|
||||
if (DBG) loge("Exception trying to remove a route: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return routesChanged;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user