From: Thomas Markwalder Date: Fri, 29 Sep 2017 15:44:32 +0000 (-0400) Subject: [5359] Moved v4 DNS remove logic from alloc engine to the server X-Git-Tag: trac5361_base~4^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=044bb373c672d44185996b63de2e84e5ae0ad539;p=thirdparty%2Fkea.git [5359] Moved v4 DNS remove logic from alloc engine to the server Moved logic to test FQDN for differences from AllocEngine::renewLease4() to Dhcpv4Srv::createNameChangeRequests(), so it can occur after we determine the FQDN for the "new" lease --- diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 602bf5efc8..218ede3683 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -1667,6 +1667,11 @@ Dhcpv4Srv::createNameChangeRequests(const Lease4Ptr& lease, "NULL lease specified when creating NameChangeRequest"); } else if (!old_lease || !lease->hasIdenticalFqdn(*old_lease)) { + if (old_lease) { + // Queue's up a remove of the old lease's DNS (if needed) + queueNCR(CHG_REMOVE, old_lease); + } + // We may need to generate the NameChangeRequest for the new lease. It // will be generated only if hostname is set and if forward or reverse // update has been requested. diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index d4f0141f9a..2694580d1a 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -2995,10 +2995,6 @@ AllocEngine::renewLease4(const Lease4Ptr& lease, if (ctx.old_lease_->expired()) { reclaimExpiredLease(ctx.old_lease_, ctx.callout_handle_); - } else if (!lease->hasIdenticalFqdn(*ctx.old_lease_)) { - // The lease is not expired but the FQDN information has - // changed. So, we have to remove the previous DNS entry. - queueNCR(CHG_REMOVE, ctx.old_lease_); } lease->state_ = Lease::STATE_DEFAULT;