summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2020-03-27 09:06:27 +0000
committerLorenzo Colitti <lorenzo@google.com>2020-03-27 11:38:33 +0000
commit7e880c4ac6e794515a060353b64db87829290938 (patch)
treef60fa6495af53abf7e123dcddb736cb7c35bf132
parentb66a87d950719bc65cd883284e1cab419f19fb7f (diff)
downloadethernet-7e880c4ac6e794515a060353b64db87829290938.tar.gz
Fix querying Ethernet availability for unprivileged callers.
Both EthernetManager#getAvailableInterfaces() and the no-arg version of EthernetManager#isAvailable() end up calling EthernetServiceImpl#getAvailableInterfaces. This method attempts to filter out restricted interfaces if the caller does not have the CONNECTIVITY_USE_RESTRICTED_NETWORKS permission. Unfortunately EthernetNetworkFactory's notion of a restricted interface is the opposite of what it should be. This means that while privileged callers can see all interfaces, unprivileged callers can only see restricted interfaces which they cannot use. Fix this by correcting NetworkInterfaceState#isRestricted(), so that unprivileged callers can see only unrestricted interfaces. Privileged callers are unaffected. This bug probably went unnoticed because restricted Ethernet interfaces are rare (likely used only on auto devices) and because the callers that care about those restricted interfaces are generally privileged. Bug: 148824036 Test: atest android.net.EthernetTetheringTest#testPhysicalEthernet Merged-In: Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 Change-Id: Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25
-rw-r--r--java/com/android/server/ethernet/EthernetNetworkFactory.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/java/com/android/server/ethernet/EthernetNetworkFactory.java b/java/com/android/server/ethernet/EthernetNetworkFactory.java
index 1c83506..f5ab8b7 100644
--- a/java/com/android/server/ethernet/EthernetNetworkFactory.java
+++ b/java/com/android/server/ethernet/EthernetNetworkFactory.java
@@ -391,7 +391,7 @@ public class EthernetNetworkFactory extends NetworkFactory {
}
boolean isRestricted() {
- return mCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED);
+ return !mCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED);
}
/**