From ac6651e0ee796c11500d3e3b0fc5fa04c734e6b4 Mon Sep 17 00:00:00 2001 From: Thomas Markwalder Date: Tue, 17 Mar 2015 14:11:57 -0400 Subject: [PATCH] [3689] Changed AllocEngine::allocateLeases6 to not reset context hostname 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 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 6cbb7ae43d..1d7ff41e61 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -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; + } } } -- 2.47.2