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

Commit c346f726 authored by Lorenzo Colitti's avatar Lorenzo Colitti Committed by android-build-merger
Browse files

Merge changes Ibb63f6b4,Ib64559a5 into nyc-dev

am: 19e84f7b

* commit '19e84f7b':
  Clean up netd state when tethering fails.
  Clear LinkProperties on interface removed.

Change-Id: I3e6593324fa955ab3c0e590655d0632347f83ec8
parents ca3fdc2b 19e84f7b
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -101,6 +101,19 @@ public class NetlinkTracker extends BaseNetworkObserver {
        }
        }
    }
    }


    @Override
    public void interfaceRemoved(String iface) {
        maybeLog("interfaceRemoved", iface);
        if (mInterfaceName.equals(iface)) {
            // Our interface was removed. Clear our LinkProperties and tell our owner that they are
            // now empty. Note that from the moment that the interface is removed, any further
            // interface-specific messages (e.g., RTM_DELADDR) will not reach us, because the netd
            // code that parses them will not be able to resolve the ifindex to an interface name.
            clearLinkProperties();
            mCallback.update();
        }
    }

    @Override
    @Override
    public void addressUpdated(String iface, LinkAddress address) {
    public void addressUpdated(String iface, LinkAddress address) {
        if (mInterfaceName.equals(iface)) {
        if (mInterfaceName.equals(iface)) {
+5 −0
Original line number Original line Diff line number Diff line
@@ -1211,6 +1211,11 @@ public class Tethering extends BaseNetworkObserver {
                    Log.e(TAG, "Error Tethering: " + e.toString());
                    Log.e(TAG, "Error Tethering: " + e.toString());
                    setLastError(ConnectivityManager.TETHER_ERROR_TETHER_IFACE_ERROR);
                    setLastError(ConnectivityManager.TETHER_ERROR_TETHER_IFACE_ERROR);


                    try {
                        mNMService.untetherInterface(mIfaceName);
                    } catch (Exception ee) {
                        Log.e(TAG, "Error untethering after failure!" + ee.toString());
                    }
                    transitionTo(mInitialState);
                    transitionTo(mInitialState);
                    return;
                    return;
                }
                }
+2 −0
Original line number Original line Diff line number Diff line
@@ -302,6 +302,7 @@ public class IpManager extends StateMachine {
                }) {
                }) {
            @Override
            @Override
            public void interfaceAdded(String iface) {
            public void interfaceAdded(String iface) {
                super.interfaceAdded(iface);
                if (mClatInterfaceName.equals(iface)) {
                if (mClatInterfaceName.equals(iface)) {
                    mCallback.setNeighborDiscoveryOffload(false);
                    mCallback.setNeighborDiscoveryOffload(false);
                }
                }
@@ -309,6 +310,7 @@ public class IpManager extends StateMachine {


            @Override
            @Override
            public void interfaceRemoved(String iface) {
            public void interfaceRemoved(String iface) {
                super.interfaceRemoved(iface);
                if (mClatInterfaceName.equals(iface)) {
                if (mClatInterfaceName.equals(iface)) {
                    // TODO: consider sending a message to the IpManager main
                    // TODO: consider sending a message to the IpManager main
                    // StateMachine thread, in case "NDO enabled" state becomes
                    // StateMachine thread, in case "NDO enabled" state becomes