diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java index ec53c16b312ed..bdbd06640e499 100644 --- a/services/core/java/com/android/server/NetworkManagementService.java +++ b/services/core/java/com/android/server/NetworkManagementService.java @@ -1310,8 +1310,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub mConnector.execute("tether", "interface", "remove", iface); } catch (NativeDaemonConnectorException e) { throw e.rethrowAsParcelableException(); + } finally { + removeInterfaceFromLocalNetwork(iface); } - removeInterfaceFromLocalNetwork(iface); } @Override diff --git a/services/core/java/com/android/server/connectivity/tethering/IPv6TetheringInterfaceServices.java b/services/core/java/com/android/server/connectivity/tethering/IPv6TetheringInterfaceServices.java index edb4347f56a3d..7525f302c1418 100644 --- a/services/core/java/com/android/server/connectivity/tethering/IPv6TetheringInterfaceServices.java +++ b/services/core/java/com/android/server/connectivity/tethering/IPv6TetheringInterfaceServices.java @@ -26,6 +26,7 @@ import android.net.RouteInfo; import android.net.ip.RouterAdvertisementDaemon; import android.net.ip.RouterAdvertisementDaemon.RaParams; import android.os.INetworkManagementService; +import android.os.ServiceSpecificException; import android.os.RemoteException; import android.util.Log; import android.util.Slog; @@ -205,7 +206,7 @@ class IPv6TetheringInterfaceServices { final String dnsString = dns.getHostAddress(); try { netd.interfaceDelAddress(mIfName, dnsString, RFC7421_IP_PREFIX_LENGTH); - } catch (RemoteException e) { + } catch (ServiceSpecificException | RemoteException e) { Log.e(TAG, "Failed to remove local dns IP: " + dnsString, e); } } @@ -222,7 +223,7 @@ class IPv6TetheringInterfaceServices { final String dnsString = dns.getHostAddress(); try { netd.interfaceAddAddress(mIfName, dnsString, RFC7421_IP_PREFIX_LENGTH); - } catch (RemoteException e) { + } catch (ServiceSpecificException | RemoteException e) { Log.e(TAG, "Failed to add local dns IP: " + dnsString, e); newDnses.remove(dns); } @@ -231,7 +232,7 @@ class IPv6TetheringInterfaceServices { try { netd.tetherApplyDnsInterfaces(); - } catch (RemoteException e) { + } catch (ServiceSpecificException | RemoteException e) { Log.e(TAG, "Failed to update local DNS caching server"); if (newDnses != null) newDnses.clear(); }