diff options
author | Tomek Mrugalski <tomasz@isc.org> | 2015-06-09 18:39:31 +0200 |
---|---|---|
committer | Tomek Mrugalski <tomasz@isc.org> | 2015-06-09 18:39:31 +0200 |
commit | a61f40c44910a09699a9a566a5ec35ab758564ba (patch) | |
tree | f374cd06a54dc3cc67cd15f81dca809807701327 /src/bin/dhcp4/tests/dhcp4_client.cc | |
parent | [master] Added ChangeLog entry for #3810. (diff) | |
parent | [3794] Another 2 static_casts added. (diff) | |
download | kea-a61f40c44910a09699a9a566a5ec35ab758564ba.tar.xz kea-a61f40c44910a09699a9a566a5ec35ab758564ba.zip |
[master] Merge branch 'trac3794' (packet statistics in DHCPv4)
Diffstat (limited to 'src/bin/dhcp4/tests/dhcp4_client.cc')
-rw-r--r-- | src/bin/dhcp4/tests/dhcp4_client.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/bin/dhcp4/tests/dhcp4_client.cc b/src/bin/dhcp4/tests/dhcp4_client.cc index ab2062af66..750e6657b2 100644 --- a/src/bin/dhcp4/tests/dhcp4_client.cc +++ b/src/bin/dhcp4/tests/dhcp4_client.cc @@ -142,6 +142,8 @@ Dhcp4Client::applyConfiguration() { return; } + // Let's keep the old lease in case this is a response to Inform. + Lease4 old_lease = config_.lease_; config_.reset(); // Routers @@ -175,11 +177,17 @@ Dhcp4Client::applyConfiguration() { config_.serverid_ = opt_serverid->readAddress(); } - /// @todo Set the valid lifetime, t1, t2 etc. - config_.lease_ = Lease4(IOAddress(context_.response_->getYiaddr()), - context_.response_->getHWAddr(), - 0, 0, 0, 0, 0, time(NULL), 0, false, false, - ""); + // If the message sent was Inform, we don't want to throw + // away the old lease info, just the bits about options. + if (context_.query_->getType() == DHCPINFORM) { + config_.lease_ = old_lease; + } else { + /// @todo Set the valid lifetime, t1, t2 etc. + config_.lease_ = Lease4(IOAddress(context_.response_->getYiaddr()), + context_.response_->getHWAddr(), + 0, 0, 0, 0, 0, time(NULL), 0, false, false, + ""); + } } void |