summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNalla Kartheek <karthe@codeaurora.org>2014-11-15 17:13:43 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2014-11-17 14:39:28 -0800
commit2941969cf21ec39b120383908f1b88ab8621c4c1 (patch)
treec16655777eabfc10e6598e94c27c915ca6a44a2c
parent5e68f8618fc5638e848c198dc5a356c6ccce780c (diff)
downloadandroid_frameworks_opt_net_wifi-2941969cf21ec39b120383908f1b88ab8621c4c1.tar.gz
android_frameworks_opt_net_wifi-2941969cf21ec39b120383908f1b88ab8621c4c1.tar.bz2
android_frameworks_opt_net_wifi-2941969cf21ec39b120383908f1b88ab8621c4c1.zip
WiFi : Fix for DHCP to Static IP configuration problem
WifiStateMachine shall update the IP address configuration to the kernel through NetworkManagementService.This notification from the kernel is again sent to the connectivity service through the NetLinkStateTracker and WiFiStateMachine. Thus ,if the interface is down during this IP address reconfiguration (for the case of DHCP to Static IP configuration), Connectivity service shall be notified with old IP address ,NULL(0) IP address(signifying interface down) and the latest IP address. This notification was done by updating the IP address using a local variable , and hence the second notification on the interface down is overridden by the last notification , resulting in missed interface down notification to the connectivity service.This resulted in failed data connection when IP address is changed from DHCP to IP on the fly. Hence ,this gerrit enhances the design and also pass the updated IP address to the connectivity service. Change-Id: Ib0b9fd02c488b709ca3cd9713d7a9d86243e0224 CRs-Fixed: 750277
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index b0fcb17c1..8937ed357 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -894,8 +894,8 @@ public class WifiStateMachine extends StateMachine {
mLastSignalLevel = -1;
mNetlinkTracker = new NetlinkTracker(mInterfaceName, new NetlinkTracker.Callback() {
- public void update() {
- sendMessage(CMD_UPDATE_LINKPROPERTIES);
+ public void update(LinkProperties lp) {
+ sendMessage(CMD_UPDATE_LINKPROPERTIES, lp);
}
});
try {
@@ -3903,7 +3903,7 @@ public class WifiStateMachine extends StateMachine {
* - IPv6 routes and DNS servers: netlink, passed in by mNetlinkTracker.
* - HTTP proxy: the wifi config store.
*/
- private void updateLinkProperties(int reason) {
+ private void updateLinkProperties(int reason, LinkProperties lp) {
LinkProperties newLp = new LinkProperties();
// Interface name and proxy are locally configured.
@@ -3911,12 +3911,11 @@ public class WifiStateMachine extends StateMachine {
newLp.setHttpProxy(mWifiConfigStore.getProxyProperties(mLastNetworkId));
// IPv4/v6 addresses, IPv6 routes and IPv6 DNS servers come from netlink.
- LinkProperties netlinkLinkProperties = mNetlinkTracker.getLinkProperties();
- newLp.setLinkAddresses(netlinkLinkProperties.getLinkAddresses());
- for (RouteInfo route : netlinkLinkProperties.getRoutes()) {
+ newLp.setLinkAddresses(lp.getLinkAddresses());
+ for (RouteInfo route : lp.getRoutes()) {
newLp.addRoute(route);
}
- for (InetAddress dns : netlinkLinkProperties.getDnsServers()) {
+ for (InetAddress dns : lp.getDnsServers()) {
newLp.addDnsServer(dns);
}
@@ -3924,7 +3923,7 @@ public class WifiStateMachine extends StateMachine {
synchronized (mDhcpResultsLock) {
// Even when we're using static configuration, we don't need to look at the config
// store, because static IP configuration also populates mDhcpResults.
- if ((mDhcpResults != null)) {
+ if ((mDhcpResults != null) && lp.hasIPv4Address()) {
for (RouteInfo route : mDhcpResults.getRoutes(mInterfaceName)) {
newLp.addRoute(route);
}
@@ -4038,7 +4037,8 @@ public class WifiStateMachine extends StateMachine {
case CMD_UPDATE_LINKPROPERTIES:
// IP addresses, DNS servers, etc. changed. Act accordingly.
- if (wasProvisioned && !isProvisioned) {
+ boolean isStatic = mWifiConfigStore.isUsingStaticIp(mLastNetworkId);
+ if (wasProvisioned && !isProvisioned && !isStatic) {
// We no longer have a usable network configuration. Disconnect.
sendMessage(CMD_IP_CONFIGURATION_LOST);
} else if (!wasProvisioned && isProvisioned) {
@@ -4403,7 +4403,7 @@ public class WifiStateMachine extends StateMachine {
}
mWifiInfo.setInetAddress(addr);
mWifiInfo.setMeteredHint(dhcpResults.hasMeteredHint());
- updateLinkProperties(reason);
+ updateLinkProperties(reason, mNetlinkTracker.getLinkProperties());
}
private void handleSuccessfulIpConfiguration() {
@@ -4440,7 +4440,7 @@ public class WifiStateMachine extends StateMachine {
if (PDBG) {
loge("wifistatemachine handleIPv4Failure");
}
- updateLinkProperties(reason);
+ updateLinkProperties(reason, mNetlinkTracker.getLinkProperties());
}
private void handleIpConfigurationLost() {
@@ -4778,7 +4778,7 @@ public class WifiStateMachine extends StateMachine {
break;
/* Link configuration (IP address, DNS, ...) changes notified via netlink */
case CMD_UPDATE_LINKPROPERTIES:
- updateLinkProperties(CMD_UPDATE_LINKPROPERTIES);
+ updateLinkProperties(CMD_UPDATE_LINKPROPERTIES, (LinkProperties)message.obj);
break;
case CMD_IP_CONFIGURATION_SUCCESSFUL:
case CMD_IP_CONFIGURATION_LOST:
@@ -6518,7 +6518,8 @@ public class WifiStateMachine extends StateMachine {
}
if (result.hasProxyChanged()) {
log("Reconfiguring proxy on connection");
- updateLinkProperties(CMD_UPDATE_LINKPROPERTIES);
+ updateLinkProperties(CMD_UPDATE_LINKPROPERTIES,
+ mNetlinkTracker.getLinkProperties());
}
}
replyToMessage(message, WifiManager.SAVE_NETWORK_SUCCEEDED);