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

Commit e6b2429c authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

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
parent af61fd0f
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);
                    }
                }
            }
        }