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

Commit 43b76dfd authored by Lorenzo Colitti's avatar Lorenzo Colitti
Browse files

Stop clatd when starting the Nat464Xlat service.

If a runtime restart happens while clatd was running, we try to
start clatd, which causes a fatal exception because netd returns
a 400 error (clatd already started.

Bug: 13450716
Bug: 15012035
Change-Id: I102a06d6193fb5f4a1ebe5ad52e5647ff72ca0da
parent b0650e8f
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -74,6 +74,14 @@ public class Nat464Xlat extends BaseNetworkObserver {
        mIsStarted = false;
        mIsRunning = false;
        mLP = new LinkProperties();

        // If this is a runtime restart, it's possible that clatd is already
        // running, but we don't know about it. If so, stop it.
        try {
            if (mNMService.isClatdStarted()) {
                mNMService.stopClatd();
            }
        } catch(RemoteException e) {}  // Well, we tried.
    }

    /**
@@ -198,13 +206,13 @@ public class Nat464Xlat extends BaseNetworkObserver {
                NetworkUtils.resetConnections(
                    CLAT_INTERFACE_NAME,
                    NetworkUtils.RESET_IPV4_ADDRESSES);
                mBaseLP.removeStackedLink(mLP);
                updateConnectivityService();
            }
            Slog.i(TAG, "interface " + CLAT_INTERFACE_NAME +
                   " removed, mIsRunning = " + mIsRunning + " -> false");
            mIsRunning = false;
            mBaseLP.removeStackedLink(mLP);
            mLP.clear();
            updateConnectivityService();
            Slog.i(TAG, "mLP = " + mLP);
        }
    }