]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3689] Changed AllocEngine::allocateLeases6 to not reset context hostname
authorThomas Markwalder <tmark@isc.org>
Tue, 17 Mar 2015 18:11:57 +0000 (14:11 -0400)
committerThomas Markwalder <tmark@isc.org>
Tue, 17 Mar 2015 18:11:57 +0000 (14:11 -0400)
src/lib/dhcpsrv/alloc_engine.cc
    AllocEngine::allocateLeases6() - now only sets context host name
    if findReservation() is called.  This was stomping on the value
    already in the context.

src/lib/dhcpsrv/alloc_engine.cc

index 6cbb7ae43d7e72c13c29374dfdd8b0afbdd06733..1d7ff41e61d31783c7a1af561c29908483761c5e 100644 (file)
@@ -349,16 +349,20 @@ AllocEngine::allocateLeases6(ClientContext6& ctx, bool find_reservation) {
             isc_throw(InvalidOperation, "DUID is mandatory for IPv6 lease allocation");
         }
 
+        /// @todo This is ONLY used for unit tests and really should be taken out
+        /// Currently production code passes in find_reservation as false
         if (find_reservation) {
+            std::cout << "***** TKM findReservation being called from allocateLeases6"
+                        << std::endl;
             findReservation(ctx);
-        }
 
-        // Let's check whether there's a hostname specified in the reservation
-        if (ctx.host_) {
-            std::string hostname = ctx.host_->getHostname();
-            // If there is, let's use it
-            if (!hostname.empty()) {
-                ctx.hostname_ = hostname;
+            // Let's check whether there's a hostname specified in the reservation
+            if (ctx.host_) {
+                std::string hostname = ctx.host_->getHostname();
+                // If there is, let's use it
+                if (!hostname.empty()) {
+                    ctx.hostname_ = hostname;
+                }
             }
         }