summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2017-04-05 20:20:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-04-05 20:20:10 +0000
commita805f151c790272d2c016cf59b89b052981bb7ae (patch)
tree3faf1783e49152afe40db93ec51b929a9d6339c7 /service
parente08dd98aa0f94d479f2b81120e76ef8c0ec779db (diff)
parent653cd53f0906a90fbf5b1d9d0bd30917043d1bfc (diff)
Merge "Check validity of staticIpConfigurations" into oc-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java11
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java28
2 files changed, 21 insertions, 18 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index b68301010..c137be8e0 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -42,8 +42,10 @@ import android.database.ContentObserver;
import android.net.ConnectivityManager;
import android.net.DhcpInfo;
import android.net.DhcpResults;
+import android.net.IpConfiguration;
import android.net.Network;
import android.net.NetworkUtils;
+import android.net.StaticIpConfiguration;
import android.net.Uri;
import android.net.ip.IpManager;
import android.net.wifi.IWifiManager;
@@ -1795,6 +1797,15 @@ public class WifiServiceImpl extends IWifiManager.Stub {
return "not PSK or 8021X";
}
}
+ if (config.getIpAssignment() == IpConfiguration.IpAssignment.STATIC) {
+ StaticIpConfiguration staticIpConf = config.getStaticIpConfiguration();
+ if (staticIpConf == null) {
+ return "null StaticIpConfiguration";
+ }
+ if (staticIpConf.ipAddress == null) {
+ return "null static ip Address";
+ }
+ }
return null;
}
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index fbe92ed88..39ece2931 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -5774,30 +5774,22 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
if (!TextUtils.isEmpty(mTcpBufferSizes)) {
mIpManager.setTcpBufferSizes(mTcpBufferSizes);
}
-
+ final IpManager.ProvisioningConfiguration prov;
if (!isUsingStaticIp) {
- final IpManager.ProvisioningConfiguration prov =
- IpManager.buildProvisioningConfiguration()
+ prov = IpManager.buildProvisioningConfiguration()
.withPreDhcpAction()
.withApfCapabilities(mWifiNative.getApfCapabilities())
.build();
- mIpManager.startProvisioning(prov);
- // Get Link layer stats so as we get fresh tx packet counters
- getWifiLinkLayerStats();
} else {
- StaticIpConfiguration config = currentConfig.getStaticIpConfiguration();
- if (config.ipAddress == null) {
- logd("Static IP lacks address");
- sendMessage(CMD_IPV4_PROVISIONING_FAILURE);
- } else {
- final IpManager.ProvisioningConfiguration prov =
- IpManager.buildProvisioningConfiguration()
- .withStaticConfiguration(config)
- .withApfCapabilities(mWifiNative.getApfCapabilities())
- .build();
- mIpManager.startProvisioning(prov);
- }
+ StaticIpConfiguration staticIpConfig = currentConfig.getStaticIpConfiguration();
+ prov = IpManager.buildProvisioningConfiguration()
+ .withStaticConfiguration(staticIpConfig)
+ .withApfCapabilities(mWifiNative.getApfCapabilities())
+ .build();
}
+ mIpManager.startProvisioning(prov);
+ // Get Link layer stats so as we get fresh tx packet counters
+ getWifiLinkLayerStats();
}
@Override