From: Razvan Becheriu Date: Wed, 11 Nov 2020 17:28:24 +0000 (+0200) Subject: [#1405] added more log warnings X-Git-Tag: Kea-1.9.2~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=828494819bf3e4149da64ac33bc65d07a952bd58;p=thirdparty%2Fkea.git [#1405] added more log warnings --- diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 9105d37e6a..d12f197887 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -916,6 +916,9 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) { continue; } + bool in_subnet = subnet->getReservationsInSubnet(); + bool out_of_pool = subnet->getReservationsOutOfPool(); + /// @todo: We support only one hint for now Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(ctx.currentIA().type_, hint); @@ -926,8 +929,6 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) { // it has been reserved for us we would have already allocated a lease. ConstHostCollection hosts; - bool in_subnet = subnet->getReservationsInSubnet(); - bool out_of_pool = subnet->getReservationsOutOfPool(); // The out-of-pool flag indicates that no client should be assigned reservations // from within the dynamic pool, and for that reason we only look at reservations that // are outside the pools, hence the inPool check. @@ -966,8 +967,6 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) { // If the lease is expired, we may likely reuse it, but... ConstHostCollection hosts; - bool in_subnet = subnet->getReservationsInSubnet(); - bool out_of_pool = subnet->getReservationsOutOfPool(); // The out-of-pool flag indicates that no client should be assigned reservations // from within the dynamic pool, and for that reason we only look at reservations that // are outside the pools, hence the inPool check. diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes index e3c903b93a..0da6b4f84c 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.mes +++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes @@ -416,6 +416,9 @@ lease from the Cassandra database for the specified address. A debug message issued when the server is attempting to update IPv6 lease from the Cassandra database for the specified address. +% DHCPSRV_DEPRECATED_RESERVATION_MODE deprecated reservation-mode parameter; use reservations-global, reservations-in-subnet and reservations-out-of-pool instead. +A warning message indicating that reservation-mode parameter is deprecated. + % DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET received bad DHCPv4o6 packet: %1 A bad DHCPv4o6 packet was received. diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc index 72b8a8dd4d..96976378b2 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc @@ -746,7 +746,9 @@ Subnet4ConfigParser::initSubnet(data::ConstElementPtr params, // Move from reservation mode to new reservations flags. ElementPtr mutable_params; mutable_params = boost::const_pointer_cast(params); - BaseNetworkParser::moveReservationMode(mutable_params); + if (BaseNetworkParser::moveReservationMode(mutable_params)) { + LOG_WARN(dhcpsrv_logger, DHCPSRV_DEPRECATED_RESERVATION_MODE); + } // Parse parameters common to all Network derivations. NetworkPtr network = boost::dynamic_pointer_cast(subnet4); @@ -1242,7 +1244,9 @@ Subnet6ConfigParser::initSubnet(data::ConstElementPtr params, // Move from reservation mode to new reservations flags. ElementPtr mutable_params; mutable_params = boost::const_pointer_cast(params); - BaseNetworkParser::moveReservationMode(mutable_params); + if (BaseNetworkParser::moveReservationMode(mutable_params)) { + LOG_WARN(dhcpsrv_logger, DHCPSRV_DEPRECATED_RESERVATION_MODE); + } // Parse parameters common to all Network derivations. NetworkPtr network = boost::dynamic_pointer_cast(subnet_);