summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2016-04-28 01:24:21 +0900
committerLorenzo Colitti <lorenzo@google.com>2016-04-29 19:57:43 +0900
commitc84dd9499807fcf281e846e46d451e677d8cbef2 (patch)
tree10e71c54b6c0a6625254d943885352fb7fd04e23
parent5b4baf7330e22b93fd32a44824b27f43e4f2a549 (diff)
downloadethernet-c84dd9499807fcf281e846e46d451e677d8cbef2.tar.gz
Disable the IpManager timeout on Ethernet.nougat-dev
This fixes a longstanding bug where after a DHCP timeout, we would never restart the DHCP client and get an IP address until the link bounced. Also, two minor improvements: 1. Dump IpManager info when dump() is called. 2. When onLinkPropertiesChange is called, also update mLinkProperties. We were already sending the updated LinkProperties to the NetworkAgent, so this is really only useful for dump(), but it's just one line and safe because onLinkPropertiesChange already grabs the lock. Bug: 17733693 Change-Id: I42c3319cb4bc151c547ed721baf5e83f97e23862
-rw-r--r--java/com/android/server/ethernet/EthernetNetworkFactory.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/java/com/android/server/ethernet/EthernetNetworkFactory.java b/java/com/android/server/ethernet/EthernetNetworkFactory.java
index 7186863..0b091f2 100644
--- a/java/com/android/server/ethernet/EthernetNetworkFactory.java
+++ b/java/com/android/server/ethernet/EthernetNetworkFactory.java
@@ -33,6 +33,7 @@ import android.net.NetworkInfo;
import android.net.NetworkInfo.DetailedState;
import android.net.StaticIpConfiguration;
import android.net.ip.IpManager;
+import android.net.ip.IpManager.ProvisioningConfiguration;
import android.net.ip.IpManager.WaitForProvisioningCallback;
import android.os.Handler;
import android.os.IBinder;
@@ -283,7 +284,6 @@ class EthernetNetworkFactory {
}
}
- // TODO: Handle DHCP renew.
final Thread ipProvisioningThread = new Thread(new Runnable() {
public void run() {
if (DBG) {
@@ -308,6 +308,7 @@ class EthernetNetworkFactory {
public void onLinkPropertiesChange(LinkProperties newLp) {
synchronized(EthernetNetworkFactory.this) {
if (mNetworkAgent != null && mNetworkInfo.isConnected()) {
+ mLinkProperties = newLp;
mNetworkAgent.sendLinkProperties(newLp);
}
}
@@ -329,7 +330,11 @@ class EthernetNetworkFactory {
mIpManager.setTcpBufferSizes(tcpBufferSizes);
}
- mIpManager.startProvisioning();
+ final ProvisioningConfiguration provisioningConfiguration =
+ mIpManager.buildProvisioningConfiguration()
+ .withProvisioningTimeoutMs(0)
+ .build();
+ mIpManager.startProvisioning(provisioningConfiguration);
}
linkProperties = ipmCallback.waitForProvisioning();
@@ -526,5 +531,11 @@ class EthernetNetworkFactory {
pw.println("NetworkInfo: " + mNetworkInfo);
pw.println("LinkProperties: " + mLinkProperties);
pw.println("NetworkAgent: " + mNetworkAgent);
+ if (mIpManager != null) {
+ pw.println("IpManager:");
+ pw.increaseIndent();
+ mIpManager.dump(fd, pw, args);
+ pw.decreaseIndent();
+ }
}
}