From: Marcin Siodelski Date: Tue, 24 Oct 2017 15:20:51 +0000 (+0200) Subject: [5387] Do not send v6 lease with zero liftimes if not our lease. X-Git-Tag: Kea-1.3.0~2^2~4^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8648b73d662bc598038e16f934acdd67b562f196;p=thirdparty%2Fkea.git [5387] Do not send v6 lease with zero liftimes if not our lease. --- diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 4d6fbe0ef2..a0aa2cb111 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -1826,9 +1827,15 @@ Dhcpv6Srv::extendIA_NA(const Pkt6Ptr& query, const Pkt6Ptr& answer, // 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); @@ -2012,6 +2019,7 @@ Dhcpv6Srv::extendIA_PD(const Pkt6Ptr& query, // 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.