From adacedb1a8b10e0e29c7c223251069c8e6ef564e Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Thu, 28 Apr 2016 13:52:56 +0900 Subject: [PATCH] Notify success before configuring the IP address. This ensures that IpManager has a complete copy of DHCP state before configuring the IPv4 address. That way, when the netlink notification of the IPv4 address arrives, we are guaranteed to have all DHCP information (including DNS servers and routes) available and we will never send the IPv4 address before the DNS servers. Bug: 27605330 Change-Id: I732424dfe2408be9e40028563e99d610b541e12d --- services/net/java/android/net/dhcp/DhcpClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/net/java/android/net/dhcp/DhcpClient.java b/services/net/java/android/net/dhcp/DhcpClient.java index 77cd9b6b355de..db521e2d51791 100644 --- a/services/net/java/android/net/dhcp/DhcpClient.java +++ b/services/net/java/android/net/dhcp/DhcpClient.java @@ -724,6 +724,7 @@ public class DhcpClient extends StateMachine { mOffer = null; Log.d(TAG, "Confirmed lease: " + mDhcpLease); setDhcpLeaseExpiry(packet); + notifySuccess(); transitionTo(mConfiguringInterfaceState); } } else if (packet instanceof DhcpNakPacket) { @@ -794,7 +795,6 @@ public class DhcpClient extends StateMachine { @Override public void enter() { super.enter(); - notifySuccess(); // TODO: DhcpStateMachine only supported renewing at 50% of the lease time, // and did not support rebinding. Now that the legacy DHCP client is gone, fix this. scheduleRenew(); @@ -850,6 +850,7 @@ public class DhcpClient extends StateMachine { if (!isValidPacket(packet)) return; if ((packet instanceof DhcpAckPacket)) { setDhcpLeaseExpiry(packet); + notifySuccess(); transitionTo(mDhcpBoundState); } else if (packet instanceof DhcpNakPacket) { transitionTo(mDhcpInitState);