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

Commit 19e84f7b authored by Lorenzo Colitti's avatar Lorenzo Colitti Committed by Android (Google) Code Review
Browse files

Merge changes Ibb63f6b4,Ib64559a5 into nyc-dev

* changes:
  Clean up netd state when tethering fails.
  Clear LinkProperties on interface removed.
parents a46be166 c42c9754
Loading
Loading
Loading
Loading
+13 −0
Original line number 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
    public void addressUpdated(String iface, LinkAddress address) {
        if (mInterfaceName.equals(iface)) {
+5 −0
Original line number Diff line number Diff line
@@ -1211,6 +1211,11 @@ public class Tethering extends BaseNetworkObserver {
                    Log.e(TAG, "Error Tethering: " + e.toString());
                    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);
                    return;
                }
+2 −0
Original line number Diff line number Diff line
@@ -302,6 +302,7 @@ public class IpManager extends StateMachine {
                }) {
            @Override
            public void interfaceAdded(String iface) {
                super.interfaceAdded(iface);
                if (mClatInterfaceName.equals(iface)) {
                    mCallback.setNeighborDiscoveryOffload(false);
                }
@@ -309,6 +310,7 @@ public class IpManager extends StateMachine {

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