summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-06-08 00:35:41 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-06-08 00:35:41 +0000
commit2a9f8b378b1d69e91abc1705e8a3d16bb3a04d93 (patch)
treeddc29e6328f2e8df7f35a0247238d7e951a64133 /service
parent6a70be37fe18f0b9b1a968a69190d3fab0505a71 (diff)
parent5574a79d435528ded31153e07c24acd25127c703 (diff)
Merge changes Ia9932379,Ic5e2fa1c into qt-dev
* changes: WifiNetworkFactory: Reject requests for internet with specifier WifiConfigStore: Add wtf for any data integrity failure
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConfigStore.java2
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkFactory.java28
2 files changed, 22 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java
index c7e75a5c4..a618eb5b5 100644
--- a/service/java/com/android/server/wifi/WifiConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiConfigStore.java
@@ -693,7 +693,7 @@ public class WifiConfigStore {
bytes = mAtomicFile.readFully();
// Check that the file has not been altered since last writeBufferedRawData()
if (!mDataIntegrityChecker.isOk(bytes)) {
- Log.e(TAG, "Data integrity problem with file: " + mFileName);
+ Log.wtf(TAG, "Data integrity problem with file: " + mFileName);
return null;
}
} catch (FileNotFoundException e) {
diff --git a/service/java/com/android/server/wifi/WifiNetworkFactory.java b/service/java/com/android/server/wifi/WifiNetworkFactory.java
index 65d78e6aa..ecc1a9f18 100644
--- a/service/java/com/android/server/wifi/WifiNetworkFactory.java
+++ b/service/java/com/android/server/wifi/WifiNetworkFactory.java
@@ -478,6 +478,23 @@ public class WifiNetworkFactory extends NetworkFactory {
return false;
}
+ boolean isRequestWithNetworkSpecifierValid(NetworkRequest networkRequest) {
+ NetworkSpecifier ns = networkRequest.networkCapabilities.getNetworkSpecifier();
+ // Invalid network specifier.
+ if (!(ns instanceof WifiNetworkSpecifier)) {
+ Log.e(TAG, "Invalid network specifier mentioned. Rejecting");
+ return false;
+ }
+ // Request cannot have internet capability since such a request can never be fulfilled.
+ // (NetworkAgent for connection with WifiNetworkSpecifier will not have internet capability)
+ if (networkRequest.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) {
+ Log.e(TAG, "Request with wifi network specifier cannot contain "
+ + "NET_CAPABILITY_INTERNET. Rejecting");
+ return false;
+ }
+ return true;
+ }
+
/**
* Check whether to accept the new network connection request.
*
@@ -486,13 +503,11 @@ public class WifiNetworkFactory extends NetworkFactory {
@Override
public boolean acceptRequest(NetworkRequest networkRequest, int score) {
NetworkSpecifier ns = networkRequest.networkCapabilities.getNetworkSpecifier();
- // Generic wifi request. Always accept.
if (ns == null) {
// Generic wifi request. Always accept.
} else {
- // Invalid network specifier.
- if (!(ns instanceof WifiNetworkSpecifier)) {
- Log.e(TAG, "Invalid network specifier mentioned. Rejecting");
+ // Invalid request with network specifier.
+ if (!isRequestWithNetworkSpecifierValid(networkRequest)) {
releaseRequestAsUnfulfillableByAnyFactory(networkRequest);
return false;
}
@@ -569,9 +584,8 @@ public class WifiNetworkFactory extends NetworkFactory {
mWifiConnectivityManager.setTrustedConnectionAllowed(true);
}
} else {
- // Invalid network specifier.
- if (!(ns instanceof WifiNetworkSpecifier)) {
- Log.e(TAG, "Invalid network specifier mentioned. Rejecting");
+ // Invalid request with network specifier.
+ if (!isRequestWithNetworkSpecifierValid(networkRequest)) {
releaseRequestAsUnfulfillableByAnyFactory(networkRequest);
return;
}