From f90d6ccc10843b6eb71ca896926a471688ba9f12 Mon Sep 17 00:00:00 2001 From: Dedy Lansky Date: Mon, 7 Oct 2019 09:14:47 +0300 Subject: [PATCH] Tethering: TETHERING_WIGIG fixes 1. enableWifiIpServingLocked uses hard-coded TETHERING_WIFI. This doesn't work well with SoftAP on Wigig interface (wigig0). Use correct interface type instead. 2. In IpServer treat Wigig same as Wifi by ignoring interface up/down commands. Change-Id: I19610bd5abcca2d8e6c225472b2cfc351ad6b341 CRs-Fixed: 2542959 --- .../java/com/android/server/connectivity/Tethering.java | 7 ++++++- services/net/java/android/net/ip/IpServer.java | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java index 00947f13aa9b0..561245e4a3055 100644 --- a/services/core/java/com/android/server/connectivity/Tethering.java +++ b/services/core/java/com/android/server/connectivity/Tethering.java @@ -868,7 +868,12 @@ private void enableWifiIpServingLocked(String ifname, int wifiIpMode) { } if (!TextUtils.isEmpty(ifname)) { - maybeTrackNewInterfaceLocked(ifname, TETHERING_WIFI); + final int interfaceType = ifaceNameToType(ifname); + if (interfaceType == TETHERING_INVALID) { + mLog.log(ifname + " is not a tetherable iface, ignoring"); + return; + } + maybeTrackNewInterfaceLocked(ifname, interfaceType); changeInterfaceState(ifname, ipServingMode); } else { mLog.e(String.format( diff --git a/services/net/java/android/net/ip/IpServer.java b/services/net/java/android/net/ip/IpServer.java index 47d01a0c6b32e..c61134962fa80 100644 --- a/services/net/java/android/net/ip/IpServer.java +++ b/services/net/java/android/net/ip/IpServer.java @@ -426,7 +426,8 @@ private boolean configureIPv4(boolean enabled) { InetAddress addr = numericToInetAddress(ipAsString); linkAddr = new LinkAddress(addr, prefixLen); ifcg.setLinkAddress(linkAddr); - if (mInterfaceType == ConnectivityManager.TETHERING_WIFI) { + if (mInterfaceType == ConnectivityManager.TETHERING_WIFI || + mInterfaceType == ConnectivityManager.TETHERING_WIGIG) { // The WiFi stack has ownership of the interface up/down state. // It is unclear whether the Bluetooth or USB stacks will manage their own // state.