Merge "Replace the way to add legacy routing" am: 41da838f4d

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1490244

Change-Id: I6a278e3ae1ac4f5eaba92d28edf4a53d5381832e
This commit is contained in:
Chiachang Wang
2020-11-11 05:23:20 +00:00
committed by Automerger Merge Worker

View File

@@ -1917,10 +1917,13 @@ public class ConnectivityService extends IConnectivityManager.Stub
}
if (DBG) log("Adding legacy route " + bestRoute +
" for UID/PID " + uid + "/" + Binder.getCallingPid());
final String dst = bestRoute.getDestinationLinkAddress().toString();
final String nextHop = bestRoute.hasGateway()
? bestRoute.getGateway().getHostAddress() : "";
try {
mNMS.addLegacyRouteForNetId(netId, bestRoute, uid);
} catch (Exception e) {
// never crash - catch them all
mNetd.networkAddLegacyRoute(netId, bestRoute.getInterface(), dst, nextHop , uid);
} catch (RemoteException | ServiceSpecificException e) {
if (DBG) loge("Exception trying to add a route: " + e);
return false;
}