diff options
| author | 2020-11-06 14:48:30 +0800 | |
|---|---|---|
| committer | 2020-11-10 14:53:55 +0800 | |
| commit | 4e05e2eff505c0cd5cdcedbba6f08b59dafc2184 (patch) | |
| tree | 3f0bc4db8760aa4b748ac824939b793cf24c02b1 | |
| parent | 64512597fd651fa5a5a9a4e061434ed3290e628c (diff) | |
Replace the way to add legacy routing
ConnectivityService is going to become a mainline module which
is not able to access hidden API. Thus, replace the usage from
NMS to INetd.
Bug: 170598012
Test: atest FrameworksNetTests ConnectivityManagerLegacyTest
Change-Id: Ice1bd1effab26555917bc1766354aeaebd41ad66
| -rw-r--r-- | services/core/java/com/android/server/ConnectivityService.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 93825ca560da..8678a665d021 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -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; } |