#include <util/encode/hex.h>
#include <util/io_utilities.h>
+#include <util/pointer_util.h>
#include <util/range_utilities.h>
#include <log/logger.h>
#include <cryptolink/cryptolink.h>
// For the leases that we just retired, send the addresses with 0 lifetimes.
for (Lease6Collection::const_iterator l = ctx.currentIA().old_leases_.begin();
l != ctx.currentIA().old_leases_.end(); ++l) {
- Option6IAAddrPtr iaaddr(new Option6IAAddr(D6O_IAADDR,
- (*l)->addr_, 0, 0));
- ia_rsp->addOption(iaaddr);
+
+ // Send an address with zero lifetimes only when this lease belonged to
+ // this client. Do not send it when we're reusing an old lease that belonged
+ // to someone else.
+ if (equalValues(query->getClientId(), (*l)->duid_)) {
+ Option6IAAddrPtr iaaddr(new Option6IAAddr(D6O_IAADDR,
+ (*l)->addr_, 0, 0));
+ ia_rsp->addOption(iaaddr);
+ }
// Now remove this address from the hints list.
AllocEngine::ResourceType hint_type((*l)->addr_, 128);
// already, inform the client that he can't have them.
for (AllocEngine::HintContainer::const_iterator prefix = hints.begin();
prefix != hints.end(); ++prefix) {
+
// Send the prefix with the zero lifetimes only if the prefix
// contains non-zero value. A zero value indicates that the hint was
// for the prefix length.