Parcourir la source

[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
Thomas Markwalder il y a 7 ans
Parent
commit
044bb373c6
2 fichiers modifiés avec 5 ajouts et 4 suppressions
  1. 5 0
      src/bin/dhcp4/dhcp4_srv.cc
  2. 0 4
      src/lib/dhcpsrv/alloc_engine.cc

+ 5 - 0
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.

+ 0 - 4
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;