summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chiachang Wang <chiachangwang@google.com> 2020-09-23 19:11:33 +0800
committer Chiachang Wang <chiachangwang@google.com> 2020-10-06 15:38:32 +0800
commitc3207fbf8d436b92aa6b0f793aa01048d7faea97 (patch)
treeae0ea00efc9d7cb714ff6f69cb1bfd17d0c8732b
parentf29902285a56562b8993a0cbce337bf4c895f406 (diff)
Prevent going through unnecessary networks
The outer interface is taken in the constructor of LegacyVpnRunner. The interface is used to set the type of connection type. One interface should not map to more than one network. Go through all the network is unnecessary if the target connection is found. Thus, skip other networks if target network is found. Bug: 169215213 Test: atest FrameworksNetTests Test: build and manually test to add legacy vpn Change-Id: I31096d07177f5ae168becb1b4311f7b8eeac855a
-rw-r--r--services/core/java/com/android/server/connectivity/Vpn.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 8e1fccd07f7a..b55fd49a434a 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -2755,7 +2755,10 @@ public class Vpn {
final LinkProperties lp = cm.getLinkProperties(network);
if (lp != null && lp.getAllInterfaceNames().contains(mOuterInterface)) {
final NetworkInfo networkInfo = cm.getNetworkInfo(network);
- if (networkInfo != null) mOuterConnection.set(networkInfo.getType());
+ if (networkInfo != null) {
+ mOuterConnection.set(networkInfo.getType());
+ break;
+ }
}
}
}