Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bde7a61a authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android (Google) Code Review
Browse files

Merge "Remove default routes for non-default networks."

parents 08633c79 e6b2429c
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1831,6 +1831,19 @@ public class ConnectivityService extends IConnectivityManager.Stub {
        for (RouteInfo r :  routeDiff.added) {
            if (isLinkDefault || ! r.isDefaultRoute()) {
                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);
                    }
                }
            }
        }