From 81cdc02a6301c59a7ebd206435bd7b7c8ac44ecd Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Tue, 13 May 2025 15:47:13 +0900 Subject: [PATCH] Ignore calls to tether() where the interface type is invalid. It looks like the code was already trying to ignore this (it reported an error to the caller), but it then continued on to create a request and call tetherInternal on it. This is still a no-op because the code will never create an IpServer for an interface that has type INVALID: IpServers are only ever created in ensureIpServerStartedForType, and the only callers are: - ensureIpServerStartedForInterface, which returns early if the type is INVALID. - enableIpServing: - enableWifiP2pIpServing: returns early if type is INVALID - enableWifiIpServing: returns early if type is INVALID - enableUsbIpServing: can only pass in USB or NCM - BluetoothCallback#onAvailable: passes in BLUETOOTH - EthernetCallback#onAvailable: passes in ETHERNET - setVirtualMachineTethering: only called with VIRTUAL - StartTetheringSoftApCallback#onStateChanged: passes in the request previously passed to it by setWifiTethering, which is always WIFI. Bug: 408087033 Test: covered by existing tests Flag: EXEMPT dead code Change-Id: I8ebba3edde93677c54488803fe4b573d78ad25a9 --- Tethering/src/com/android/networkstack/tethering/Tethering.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Tethering/src/com/android/networkstack/tethering/Tethering.java b/Tethering/src/com/android/networkstack/tethering/Tethering.java index 0b615e9ea4..efbaee4ea6 100644 --- a/Tethering/src/com/android/networkstack/tethering/Tethering.java +++ b/Tethering/src/com/android/networkstack/tethering/Tethering.java @@ -1134,6 +1134,7 @@ public class Tethering { if (type == TETHERING_INVALID) { Log.e(TAG, "Ignoring call to legacy tether for unknown iface " + iface); sendTetherResult(listener, TETHER_ERROR_UNKNOWN_IFACE); + return; } TetheringRequest request = mRequestTracker.getNextPendingRequest(type);