From: Marcin Siodelski Date: Tue, 16 Jun 2015 08:54:21 +0000 (+0200) Subject: [3852] Addressed review comments. X-Git-Tag: trac3830_base~11^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4d00407a10bc4fd1348ceeebe13353eb27fc95fc;p=thirdparty%2Fkea.git [3852] Addressed review comments. --- diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 9c950d8909..a953badbdb 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -742,11 +742,13 @@ AllocEngine::allocateReservedLeases6(ClientContext6& ctx, Lease6Collection& exis if (ctx.type_ == Lease::TYPE_NA) { LOG_INFO(alloc_engine_logger, ALLOC_ENGINE_V6_HR_ADDR_GRANTED) - .arg(addr.toText()).arg(ctx.duid_->toText()); + .arg(addr.toText()) + .arg(ctx.query_->getLabel()); } else { LOG_INFO(alloc_engine_logger, ALLOC_ENGINE_V6_HR_PREFIX_GRANTED) - .arg(addr.toText()).arg(static_cast(prefix_len)) - .arg(ctx.duid_->toText()); + .arg(addr.toText()) + .arg(static_cast(prefix_len)) + .arg(ctx.query_->getLabel()); } // We found a lease for this client and this IA. Let's return. @@ -1128,11 +1130,6 @@ AllocEngine::extendLease6(ClientContext6& ctx, Lease6Ptr lease) { return; } - LOG_DEBUG(alloc_engine_logger, ALLOC_ENGINE_DBG_TRACE_DETAIL_DATA, - ALLOC_ENGINE_V6_EXTEND_LEASE_DATA) - .arg(ctx.query_->getLabel()) - .arg(lease->toText()); - // Check if the lease still belongs to the subnet. If it doesn't, // we'll need to remove it. if ((lease->type_ != Lease::TYPE_PD) && !ctx.subnet_->inRange(lease->addr_)) { @@ -1147,6 +1144,11 @@ AllocEngine::extendLease6(ClientContext6& ctx, Lease6Ptr lease) { return; } + LOG_DEBUG(alloc_engine_logger, ALLOC_ENGINE_DBG_TRACE_DETAIL_DATA, + ALLOC_ENGINE_V6_EXTEND_LEASE_DATA) + .arg(ctx.query_->getLabel()) + .arg(lease->toText()); + // Keep the old data in case the callout tells us to skip update. Lease6 old_data = *lease; @@ -1453,7 +1455,8 @@ AllocEngine::discoverLease4(AllocEngine::ClientContext4& ctx) { // allocate in the DHCPREQUEST time. new_lease = allocateOrReuseLease4(ctx.host_->getIPv4Reservation(), ctx); if (!new_lease) { - LOG_WARN(alloc_engine_logger, ALLOC_ENGINE_DISCOVER_ADDRESS_CONFLICT) + LOG_WARN(alloc_engine_logger, ALLOC_ENGINE_V4_DISCOVER_ADDRESS_CONFLICT) + .arg(ctx.query_->getLabel()) .arg(ctx.host_->getIPv4Reservation().toText()) .arg(ctx.conflicting_lease_ ? ctx.conflicting_lease_->toText() : "(no lease info)"); @@ -1496,7 +1499,8 @@ AllocEngine::discoverLease4(AllocEngine::ClientContext4& ctx) { !addressReserved(ctx.requested_address_, ctx)) { LOG_DEBUG(alloc_engine_logger, ALLOC_ENGINE_DBG_TRACE, - ALLOC_ENGINE_V4_OFFER_NEW_LEASE) + ALLOC_ENGINE_V4_OFFER_REQUESTED_LEASE) + .arg(ctx.requested_address_.toText()) .arg(ctx.query_->getLabel()); new_lease = allocateOrReuseLease4(ctx.requested_address_, ctx); diff --git a/src/lib/dhcpsrv/alloc_engine_messages.mes b/src/lib/dhcpsrv/alloc_engine_messages.mes index 378bcd293c..81fdb6d62a 100644 --- a/src/lib/dhcpsrv/alloc_engine_messages.mes +++ b/src/lib/dhcpsrv/alloc_engine_messages.mes @@ -14,23 +14,19 @@ $NAMESPACE isc::dhcp -% ALLOC_ENGINE_DISCOVER_ADDRESS_CONFLICT conflicting reservation for address %1 with existing lease %2 -This warning message is issued when the DHCP server finds that the -address reserved for the client can't be offered because this address -is currently allocated to another client. The server will try to allocate -a different address to the client to use until the conflict is resolved. - % ALLOC_ENGINE_V4_ALLOC_ERROR %1: error during attempt to allocate an IPv4 address: %2 An error occurred during an attempt to allocate an IPv4 address, the reason for the failure being contained in the message. The server will -return a message to the client refusing a lease. +return a message to the client refusing a lease. The first argument +includes the client identification information. % ALLOC_ENGINE_V4_ALLOC_FAIL %1: failed to allocate an IPv4 address after %2 attempt(s) The DHCP allocation engine gave up trying to allocate an IPv4 address after the specified number of attempts. This probably means that the address pool from which the allocation is being attempted is either empty, or very nearly empty. As a result, the client will have been -refused a lease. +refused a lease. The first argument includes the client identification +information. This message may indicate that your address pool is too small for the number of clients you are trying to service and should be expanded. @@ -40,20 +36,27 @@ consider reducing the lease lifetime. In this way, addresses allocated to clients that are no longer active on the network will become available sooner. -% ALLOC_ENGINE_V4_DISCOVER_HR %1: client sending DHCPDISCOVER has reservation for the address %2 +% ALLOC_ENGINE_V4_DISCOVER_ADDRESS_CONFLICT %1: conflicting reservation for address %2 with existing lease %3 +This warning message is issued when the DHCP server finds that the +address reserved for the client can't be offered because this address +is currently allocated to another client. The server will try to allocate +a different address to the client to use until the conflict is resolved. +The first argument includes the client identification information. + +% ALLOC_ENGINE_V4_DISCOVER_HR client %1 sending DHCPDISCOVER has reservation for the address %2 This message is issued when the allocation engine determines that the client sending the DHCPDISCOVER has a reservation for the specified address. The allocation engine will try to offer this address to the client. -% ALLOC_ENGINE_V4_OFFER_EXISTING_LEASE %1: allocation engine will try to offer existing lease to the client +% ALLOC_ENGINE_V4_OFFER_EXISTING_LEASE allocation engine will try to offer existing lease to the client %1 This message is issued when the allocation engine determines that the client has a lease in the lease database, it doesn't have reservation for any other lease, and the leased address is not reserved for any other client. The allocation engine will try to offer the same lease to the client. -% ALLOC_ENGINE_V4_OFFER_NEW_LEASE %1: allocation engine will try to offer new lease to the client +% ALLOC_ENGINE_V4_OFFER_NEW_LEASE allocation engine will try to offer new lease to the client %1 This message is issued when the allocation engine will try to offer a new lease to the client. This is the case when the client doesn't have any existing lease, it has no reservation @@ -61,32 +64,36 @@ or the existing or reserved address is leased to another client. Also, the client didn't specify a hint, or the address in the hint is in use. -% ALLOC_ENGINE_V4_OFFER_REQUESTED_LEASE %1: allocation engine will try to offer requested lease to the client +% ALLOC_ENGINE_V4_OFFER_REQUESTED_LEASE allocation engine will try to offer requested lease %1 to the client %2 This message is issued when the allocation engine will try to -offer the lease specified in the hint, because the client doesn't -have any reservations or the reserved or currently allocated -address is leased to another client. +offer the lease specified in the hint. This situation may occur +when: (a) client doesn't have any reservations, (b) client has +reservation but the reserved address is leased to another client. % ALLOC_ENGINE_V4_REQUEST_ADDRESS_RESERVED %1: requested address %2 is reserved This message is issued when the allocation engine refused to allocate address requested by the client because this -address is reserved for another client. +address is reserved for another client. The first argument +includes the client identification information. % ALLOC_ENGINE_V4_REQUEST_ALLOC_REQUESTED %1: trying to allocate requested address %2 This message is issued when the allocation engine is trying to allocate (or reuse an expired) address which has been -requested by the client. +requested by the client. The first argument includes the +client identification information. % ALLOC_ENGINE_V4_REQUEST_EXTEND_LEASE %1: extending lifetime of the lease for address %2 This message is issued when the allocation engine determines that the client already has a lease whose lifetime can be extended, and which can be returned to the client. +The first argument includes the client identification information. % ALLOC_ENGINE_V4_REQUEST_IN_USE %1: requested address %2 is in use This message is issued when the client is requesting or has a -reservation for an address which is in use. +reservation for an address which is in use. The first argument +includes the client identification information. -% ALLOC_ENGINE_V4_REQUEST_INVALID %1: client having a reservation for address %2 is requesting invalid address %3 +% ALLOC_ENGINE_V4_REQUEST_INVALID client %1 having a reservation for address %2 is requesting invalid address %3 This message is logged when the client, having a reservation for one address, is requesting a different address. The client is only allowed to do this when the reserved address is in use by @@ -94,14 +101,14 @@ another client. However, the allocation engine has determined that the reserved address is available and the client should request the reserved address. -% ALLOC_ENGINE_V4_REQUEST_OUT_OF_POOL %1: client which doesn't have reservation requested address of the dynamic pool +% ALLOC_ENGINE_V4_REQUEST_OUT_OF_POOL client %1, which doesn't have reservation, requested address out of the dynamic pool This message is issued when the client has requested allocation of the address which doesn't belong to any address pool from which addresses are dynamically allocated. The client also doesn't have reservation for this address. This address could only be allocated if the client had reservation for it. -% ALLOC_ENGINE_V4_REQUEST_PICK_ADDRESS %1: client hasn't specified an address - picking available address from the pool +% ALLOC_ENGINE_V4_REQUEST_PICK_ADDRESS client %1 hasn't specified an address - picking available address from the pool This message is logged when the client hasn't specified any preferred address (the client should always do it, but Kea tries to be forgiving). The allocation engine will try to pick an available @@ -111,7 +118,7 @@ address from the dynamic pool and allocate it to the client. This message is logged when the allocation engine removes previous lease for the client because the cliet has been allocated new one. -% ALLOC_ENGINE_V4_REQUEST_USE_HR %1: client hasn't requested specific address, using reserved address %2 +% ALLOC_ENGINE_V4_REQUEST_USE_HR client %1 hasn't requested specific address, using reserved address %2 This message is issued when the client is not requesting any specific address but the allocation engine has determined that there is a reservation for this client. The allocation engine will try to @@ -120,19 +127,22 @@ allocate the reserved address. % ALLOC_ENGINE_V4_REUSE_EXPIRED_LEASE_DATA %1: reusing expired lease, updated lease information: %2 This message is logged when the allocation engine is reusing an existing lease. The details of the updated lease are -printed. +printed. The first argument includes the client identification +information. % ALLOC_ENGINE_V6_ALLOC_ERROR %1: error during attempt to allocate an IPv6 address: %2 An error occurred during an attempt to allocate an IPv6 address, the reason for the failure being contained in the message. The server will -return a message to the client refusing a lease. +return a message to the client refusing a lease. The first argument +includes the client identification information. % ALLOC_ENGINE_V6_ALLOC_FAIL %1: failed to allocate an IPv6 address after %2 attempt(s) The DHCP allocation engine gave up trying to allocate an IPv6 address after the specified number of attempts. This probably means that the address pool from which the allocation is being attempted is either empty, or very nearly empty. As a result, the client will have been -refused a lease. +refused a lease. The first argument includes the client identification +information. This message may indicate that your address pool is too small for the number of clients you are trying to service and should be expanded. @@ -145,9 +155,10 @@ available sooner. % ALLOC_ENGINE_V6_ALLOC_HR_LEASE_EXISTS %1: lease type %2 for reserved address/prefix %3 already exists This debug message is issued when the allocation engine determines that the lease for the IPv6 address or prefix has already been allocated -for the client and the client can continue using it. +for the client and the client can continue using it. The first argument +includes the client identification information. -% ALLOC_ENGINE_V6_ALLOC_LEASES_HR %1: leases and static reservations found for client +% ALLOC_ENGINE_V6_ALLOC_LEASES_HR leases and static reservations found for client %1 This message is logged when the allocation engine is in the process of allocating leases for the client, it found existing leases and static reservations for the client. The allocation engine will verify if @@ -156,7 +167,7 @@ other clients and those that are not reserved for the client will be removed. All leases matching the reservations will be renewed and returned. -% ALLOC_ENGINE_V6_ALLOC_NO_LEASES_HR %1: no leases found but reservations exist for client +% ALLOC_ENGINE_V6_ALLOC_NO_LEASES_HR no leases found but reservations exist for client %1 This message is logged when the allocation engine is in the process of allocating leases for the client. It hasn't found any existing leases for this client, but the client appears to have static reservations. @@ -167,21 +178,25 @@ the client. This message is logged when the allocation engine determines that the client has no IPv6 reservations and thus the allocation engine will have to try to allocate allocating leases from the dynamic pool or stop -the allocation process if none can be allocated. +the allocation process if none can be allocated. The first argument +includes the client identification information. -% ALLOC_ENGINE_V6_ALLOC_LEASES_NO_HR %1: no reservations found but leases exist for client +% ALLOC_ENGINE_V6_ALLOC_LEASES_NO_HR no reservations found but leases exist for client %1 This message is logged when the allocation engine is in the process if allocating leases for the client, there are no static reservations, but lease(s) exist for the client. The allocation engine will remove leases which are reserved for other clients, and return all remaning leases to the client. -% ALLOC_ENGINE_V6_ALLOC_UNRESERVED %1: no static reservations: trying to dynamically allocate leases +% ALLOC_ENGINE_V6_ALLOC_UNRESERVED no static reservations available - trying to dynamically allocate leases for client %1 This debug message is issued when the allocation engine will attempt -to allocate leases from the dynamic pools, rather than reserved -leases. +to allocate leases from the dynamic pools. This may be due to one of +(a) there are no reservations for this client, (b) there are +reservations for the client but they are not usable because the addresses +are in use by another client or (c) we had a reserved lease but that +has now been allocated to another client. -% ALLOC_ENGINE_V6_EXTEND_ALLOC_UNRESERVED %1: allocate new (unreserved) leases for the renewing client +% ALLOC_ENGINE_V6_EXTEND_ALLOC_UNRESERVED allocate new (unreserved) leases for the renewing client %1 This debug message is issued when the allocation engine is trying to allocate new leases for the renewing client because it was unable to renew any of the existing client's leases, e.g. because leases are @@ -189,43 +204,49 @@ reserved for another client or for any other reason. % ALLOC_ENGINE_V6_EXTEND_LEASE %1: extending lifetime of the lease type %2, address %3 This debug message is issued when the allocation engine is trying -to extend lifetime of the lease. +to extend lifetime of the lease. The first argument includes the +client identification information. % ALLOC_ENGINE_V6_EXTEND_LEASE_DATA %1: detailed information about the lease being extended: %2 This debug message prints detailed information about the lease which -lifetime is being extended (renew or rebind). +lifetime is being extended (renew or rebind). The first argument +includes the client identification information. % ALLOC_ENGINE_V6_EXTEND_NEW_LEASE_DATA %1: new lease information for the lease being extended: %2 This debug message prints updated information about the lease to be extended. If the lease update is successful, the information printed -by this message will be stored in the database. +by this message will be stored in the database. The first argument +includes the client identification information. % ALLOC_ENGINE_V6_EXTEND_ERROR %1: allocation engine experienced error with attempting to extend lease lifetime: %2 This error message indicates that an error was experienced during Renew or Rebind processing. Additional explanation is provided with this message. Depending on its nature, manual intervention may be required to continue processing messages from this particular client; other clients -will be unaffected. +will be unaffected. The first argument includes the client identification +information. % ALLOC_ENGINE_V6_EXPIRED_HINT_RESERVED %1: expired lease for the client's hint %2 is reserved for another client This message is logged when the allocation engine finds that the expired lease for the client's hint can't be reused because it -is reserved for another client. +is reserved for another client. The first argument includes the +client identification information. % ALLOC_ENGINE_V6_HINT_RESERVED %1: lease for the client's hint %2 is reserved for another client This message is logged when the allocation engine cannot allocate the lease using the client's hint because the lease for this hint -is reserved for another client. +is reserved for another client. The first argument includes the +client identification information. -% ALLOC_ENGINE_V6_HR_ADDR_GRANTED reserved address %1 was was assigned to client (duid=%2) +% ALLOC_ENGINE_V6_HR_ADDR_GRANTED reserved address %1 was was assigned to client %2 This informational message signals that the specified client was assigned the address reserved for it. -% ALLOC_ENGINE_V6_HR_PREFIX_GRANTED reserved prefix %1/%2 was was assigned to client (duid=%3) +% ALLOC_ENGINE_V6_HR_PREFIX_GRANTED reserved prefix %1/%2 was was assigned to client %3 This informational message signals that the specified client was assigned the prefix reserved for it. -% ALLOC_ENGINE_V6_RENEW_HR %1: allocating leases reserved for the client as a result of Renew +% ALLOC_ENGINE_V6_RENEW_HR allocating leases reserved for the client %1 as a result of Renew This debug message is issued when the allocation engine tries to allocate reserved leases for the client sending a Renew message. The server will also remove any leases that the client is trying @@ -235,9 +256,10 @@ to renew that are not reserved for the client. This message is logged when the allocation engine finds leases for the client and will check if these leases are reserved for another client. If they are, they will not be renewed for the client -requesting their renewal. +requesting their renewal. The first argument includes the client +identification information. -% ALLOC_ENGINE_V6_RENEW_REMOVE_UNRESERVED %1: dynamically allocating leases for the renewing client +% ALLOC_ENGINE_V6_RENEW_REMOVE_UNRESERVED dynamically allocating leases for the renewing client %1 This debug message is issued as the allocation engine is trying to dynamically allocate new leases for the renewing client. This is the case when the server couldn't renew any of the existing @@ -247,7 +269,8 @@ another client. % ALLOC_ENGINE_V6_REUSE_EXPIRED_LEASE_DATA %1: reusing expired lease, updated lease information: %2 This message is logged when the allocation engine is reusing an existing lease. The details of the updated lease are -printed. +printed. The first argument includes the client identification +information. % ALLOC_ENGINE_V6_REVOKED_ADDR_LEASE address %1 was revoked from client %2 as it is reserved for client %3 This informational message is an indication that the specified IPv6