summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2020-04-14 04:41:13 +0000
committerXiao Ma <xiaom@google.com>2020-04-16 05:24:09 +0000
commit2f80c66ca51c7aaf7f708c0edcb6d4344e82d483 (patch)
tree2482ba0bfe24a5878f65dd7579c2ac97e052e770
parent9aef7f0ee06f4715e5e447303752f33656689d91 (diff)
Fix the incorrect behaviour when receiving a mismatched renew lease.
When the DHCP client is given a new IPv4 address which is not its previous network address to be extended durig RENEWING or REBINDING state, should roll back to INIT state and restart DHCP configuration. That's the intended behaviour with this fix (notify provisioning failure and then exit from receivePacket() immediately, DO NOT accept this renew lease). Otherwise, the new given network address will be accepted and noitfy IpClient to configure this new address on interface, which violates RFC2131#4.4.5. The incorect call graph will be: - receiving mismatched renew lease: - setDhcpLeaseExpiry - acceptDhcpResults - notifySuccess - transitionTo(mDhcpBoundState) - keep using this new address Bug: 131797393 Test: atest NetworkStackTests Merged-In: I6fd37e6af1f6bf3a8ce8de7b9a1ef4731de5db27 Change-Id: I6fd37e6af1f6bf3a8ce8de7b9a1ef4731de5db27
-rw-r--r--src/android/net/dhcp/DhcpClient.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/android/net/dhcp/DhcpClient.java b/src/android/net/dhcp/DhcpClient.java
index 41e54a4..794e635 100644
--- a/src/android/net/dhcp/DhcpClient.java
+++ b/src/android/net/dhcp/DhcpClient.java
@@ -1717,6 +1717,7 @@ public class DhcpClient extends StateMachine {
Log.d(TAG, "Renewed lease not for our current IP address!");
notifyFailure();
transitionTo(mDhcpInitState);
+ return;
}
setDhcpLeaseExpiry(packet);
// Updating our notion of DhcpResults here only causes the