Merge changes Ibb63f6b4,Ib64559a5 into nyc-dev

* changes:
  Clean up netd state when tethering fails.
  Clear LinkProperties on interface removed.
This commit is contained in:
Lorenzo Colitti
2016-04-05 13:35:07 +00:00
committed by Android (Google) Code Review
3 changed files with 20 additions and 0 deletions

View File

@ -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)) {

View File

@ -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;
}

View File

@ -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