daniel
Committed by Gerrit Code Review

[Falcon] Dhcp Bug Fix

- buildReply method refers the leasetime stored in ipAssignment

Change-Id: If0477861696bd76b3c1c14983f013968b4b8e8eb
...@@ -354,7 +354,8 @@ public class DhcpManager implements DhcpService { ...@@ -354,7 +354,8 @@ public class DhcpManager implements DhcpService {
354 option = new DHCPOption(); 354 option = new DHCPOption();
355 option.setCode(DHCP.DHCPOptionCode.OptionCode_LeaseTime.getValue()); 355 option.setCode(DHCP.DHCPOptionCode.OptionCode_LeaseTime.getValue());
356 option.setLength((byte) 4); 356 option.setLength((byte) 4);
357 - option.setData(ByteBuffer.allocate(4).putInt(leaseTime).array()); 357 + option.setData(ByteBuffer.allocate(4)
358 + .putInt(ipAssignment == null ? leaseTime : ipAssignment.leasePeriod()).array());
358 optionList.add(option); 359 optionList.add(option);
359 360
360 // IP Address Renewal Time. 361 // IP Address Renewal Time.
......
...@@ -208,7 +208,7 @@ public class DistributedDhcpStore implements DhcpStore { ...@@ -208,7 +208,7 @@ public class DistributedDhcpStore implements DhcpStore {
208 assignment = IpAssignment.builder() 208 assignment = IpAssignment.builder()
209 .ipAddress(ipAddr) 209 .ipAddress(ipAddr)
210 .timestamp(new Date()) 210 .timestamp(new Date())
211 - .leasePeriod(leaseTime) 211 + .leasePeriod(existingAssignment.leasePeriod())
212 .rangeNotEnforced(true) 212 .rangeNotEnforced(true)
213 .assignmentStatus(IpAssignment.AssignmentStatus.Option_RangeNotEnforced) 213 .assignmentStatus(IpAssignment.AssignmentStatus.Option_RangeNotEnforced)
214 .subnetMask(existingAssignment.subnetMask()) 214 .subnetMask(existingAssignment.subnetMask())
......