From 31da595b7845aaebc552e3b1e18abd90fc5e38fb Mon Sep 17 00:00:00 2001 From: Piotrek Zadroga Date: Thu, 25 Apr 2024 16:12:51 +0200 Subject: [#2820] add tid in some packets logs --- src/bin/dhcp4/dhcp4_messages.cc | 20 +++++++++----------- src/bin/dhcp4/dhcp4_messages.h | 1 - src/bin/dhcp4/dhcp4_messages.mes | 21 +++++++++------------ src/bin/dhcp4/dhcp4_srv.cc | 29 +++++++++++++++++++++-------- src/bin/dhcp4/dhcp4to6_ipc.cc | 7 +++++++ src/bin/dhcp6/dhcp6_messages.mes | 20 ++++++++++---------- src/bin/dhcp6/dhcp6_srv.cc | 34 ++++++++++++++++++++++++++-------- src/bin/dhcp6/dhcp6to4_ipc.cc | 8 +++++++- 8 files changed, 89 insertions(+), 51 deletions(-) diff --git a/src/bin/dhcp4/dhcp4_messages.cc b/src/bin/dhcp4/dhcp4_messages.cc index 187bfc65e1..3a556e9e51 100644 --- a/src/bin/dhcp4/dhcp4_messages.cc +++ b/src/bin/dhcp4/dhcp4_messages.cc @@ -186,7 +186,6 @@ extern const isc::log::MessageID DHCP4_SUBNET_SELECTED = "DHCP4_SUBNET_SELECTED" extern const isc::log::MessageID DHCP4_SUBNET_SELECTION_FAILED = "DHCP4_SUBNET_SELECTION_FAILED"; extern const isc::log::MessageID DHCP4_TESTING_MODE_SEND_TO_SOURCE_ENABLED = "DHCP4_TESTING_MODE_SEND_TO_SOURCE_ENABLED"; extern const isc::log::MessageID DHCP4_UNKNOWN_ADDRESS_REQUESTED = "DHCP4_UNKNOWN_ADDRESS_REQUESTED"; -extern const isc::log::MessageID DHCP6_DHCP4O6_PACKET_RECEIVED = "DHCP6_DHCP4O6_PACKET_RECEIVED"; } // namespace dhcp } // namespace isc @@ -196,10 +195,10 @@ namespace { const char* values[] = { "DHCP4_ACTIVATE_INTERFACE", "activating interface %1", "DHCP4_ALREADY_RUNNING", "%1 already running? %2", - "DHCP4_BUFFER_RECEIVED", "received buffer from %1:%2 to %3:%4 over interface %5", - "DHCP4_BUFFER_RECEIVE_FAIL", "error on attempt to receive packet: %1", + "DHCP4_BUFFER_RECEIVED", "%1: received buffer from %2:%3 to %4:%5 over interface %6", + "DHCP4_BUFFER_RECEIVE_FAIL", "%1: error on attempt to receive packet: %2", "DHCP4_BUFFER_UNPACK", "%1: parsing buffer received from %2 to %3 over interface %4", - "DHCP4_BUFFER_WAIT_SIGNAL", "signal received while waiting for next packet", + "DHCP4_BUFFER_WAIT_SIGNAL", "%1: signal received while waiting for next packet", "DHCP4_CB_ON_DEMAND_FETCH_UPDATES_FAIL", "error on demand attempt to fetch configuration updates from the configuration backend(s): %1", "DHCP4_CB_PERIODIC_FETCH_UPDATES_FAIL", "error on periodic attempt to fetch configuration updates from the configuration backend(s): %1", "DHCP4_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED", "maximum number of configuration fetch attempts: 10, has been exhausted without success", @@ -244,13 +243,13 @@ const char* values[] = { "DHCP4_DEFERRED_OPTION_UNPACK_FAIL", "%1: An error unpacking the deferred option %2: %3", "DHCP4_DEPRECATED", "The following mechanism is now deprecated and will be removed in the future: %1", "DHCP4_DEVELOPMENT_VERSION", "This software is a development branch of Kea. It is not recommended for production use.", - "DHCP4_DHCP4O6_BAD_PACKET", "received malformed DHCPv4o6 packet: %1", + "DHCP4_DHCP4O6_BAD_PACKET", "%1: received malformed DHCPv4o6 packet: %2", "DHCP4_DHCP4O6_HOOK_SUBNET4_SELECT_DROP", "%1: packet was dropped, because a callout set the next step to 'drop'", "DHCP4_DHCP4O6_HOOK_SUBNET4_SELECT_SKIP", "%1: no subnet was selected, because a callout set the next skip flag", - "DHCP4_DHCP4O6_PACKET_RECEIVED", "received DHCPv4o6 packet from DHCPv4 server (type %1) for %2 on interface %3", + "DHCP4_DHCP4O6_PACKET_RECEIVED", "%1: received DHCPv4o6 packet from DHCPv4 server (type %2) for %3 on interface %4", "DHCP4_DHCP4O6_PACKET_SEND", "%1: trying to send packet %2 (type %3) to %4 port %5 on interface %6 encapsulating %7: %8 (type %9)", "DHCP4_DHCP4O6_PACKET_SEND_FAIL", "%1: failed to send DHCPv4o6 packet: %2", - "DHCP4_DHCP4O6_RECEIVE_FAIL", "failed to receive DHCPv4o6: %1", + "DHCP4_DHCP4O6_RECEIVE_FAIL", "%1: failed to receive DHCPv4o6: %2", "DHCP4_DHCP4O6_RECEIVING", "receiving DHCPv4o6 packet from DHCPv6 server", "DHCP4_DHCP4O6_RESPONSE_DATA", "%1: responding with packet %2 (type %3), packet details: %4", "DHCP4_DHCP4O6_SUBNET_DATA", "%1: the selected subnet details: %2", @@ -261,7 +260,7 @@ const char* values[] = { "DHCP4_DYNAMIC_RECONFIGURATION_FAIL", "dynamic server reconfiguration failed with file: %1", "DHCP4_DYNAMIC_RECONFIGURATION_SUCCESS", "dynamic server reconfiguration succeeded with file: %1", "DHCP4_EMPTY_HOSTNAME", "%1: received empty hostname from the client, skipping processing of this option", - "DHCP4_FLEX_ID", "flexible identifier generated for incoming packet: %1", + "DHCP4_FLEX_ID", "%1: flexible identifier generated for incoming packet: %2", "DHCP4_GENERATE_FQDN", "%1: client did not send a FQDN or hostname; FQDN will be generated for the client", "DHCP4_HANDLE_SIGNAL_EXCEPTION", "An exception was thrown while handing signal: %1", "DHCP4_HOOKS_LIBS_RELOAD_FAIL", "reload of hooks libraries failed", @@ -324,8 +323,8 @@ const char* values[] = { "DHCP4_PACKET_OPTION_UNPACK_FAIL", "An error unpacking the option %1: %2", "DHCP4_PACKET_PACK", "%1: preparing on-wire format of the packet to be sent", "DHCP4_PACKET_PACK_FAIL", "%1: preparing on-wire-format of the packet to be sent failed %2", - "DHCP4_PACKET_PROCESS_EXCEPTION", "exception occurred during packet processing", - "DHCP4_PACKET_PROCESS_STD_EXCEPTION", "exception occurred during packet processing: %1", + "DHCP4_PACKET_PROCESS_EXCEPTION", "%1: exception occurred during packet processing", + "DHCP4_PACKET_PROCESS_STD_EXCEPTION", "%1: exception occurred during packet processing: %2", "DHCP4_PACKET_QUEUE_FULL", "multi-threading packet queue is full", "DHCP4_PACKET_RECEIVED", "%1: %2 (type %3) received from %4 to %5 on interface %6", "DHCP4_PACKET_SEND", "%1: trying to send packet %2 (type %3) from %4:%5 to %6:%7 on interface %8", @@ -373,7 +372,6 @@ const char* values[] = { "DHCP4_SUBNET_SELECTION_FAILED", "%1: failed to select subnet for the client", "DHCP4_TESTING_MODE_SEND_TO_SOURCE_ENABLED", "All packets will be send to source address of an incoming packet - use only for testing", "DHCP4_UNKNOWN_ADDRESS_REQUESTED", "%1: client requested an unknown address, client sent ciaddr %2, requested-ip-address %3", - "DHCP6_DHCP4O6_PACKET_RECEIVED", "received DHCPv4o6 packet from DHCPv6 server (type %1) for %2 port %3 on interface %4", NULL }; diff --git a/src/bin/dhcp4/dhcp4_messages.h b/src/bin/dhcp4/dhcp4_messages.h index 79c5631acd..3b4f25c51a 100644 --- a/src/bin/dhcp4/dhcp4_messages.h +++ b/src/bin/dhcp4/dhcp4_messages.h @@ -187,7 +187,6 @@ extern const isc::log::MessageID DHCP4_SUBNET_SELECTED; extern const isc::log::MessageID DHCP4_SUBNET_SELECTION_FAILED; extern const isc::log::MessageID DHCP4_TESTING_MODE_SEND_TO_SOURCE_ENABLED; extern const isc::log::MessageID DHCP4_UNKNOWN_ADDRESS_REQUESTED; -extern const isc::log::MessageID DHCP6_DHCP4O6_PACKET_RECEIVED; } // namespace dhcp } // namespace isc diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index 2cd097675d..1c50bb8fcc 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -22,13 +22,13 @@ the server. In such an event, it would be necessary to manually remove the PID file. The first argument is the DHCPv4 process name, the second contains the PID and PID file. -% DHCP4_BUFFER_RECEIVED received buffer from %1:%2 to %3:%4 over interface %5 +% DHCP4_BUFFER_RECEIVED %1: received buffer from %2:%3 to %4:%5 over interface %6 This debug message is logged when the server has received a packet over the socket. When the message is logged the contents of the received packet hasn't been parsed yet. The only available information is the interface and the source and destination IPv4 addresses/ports. -% DHCP4_BUFFER_RECEIVE_FAIL error on attempt to receive packet: %1 +% DHCP4_BUFFER_RECEIVE_FAIL %1: error on attempt to receive packet: %2 The DHCPv4 server tried to receive a packet but an error occurred during this attempt. The reason for the error is included in the message. @@ -39,7 +39,7 @@ buffer holding the DHCPv4 message. The arguments specify the source and destination IPv4 addresses as well as the interface over which the buffer has been received. -% DHCP4_BUFFER_WAIT_SIGNAL signal received while waiting for next packet +% DHCP4_BUFFER_WAIT_SIGNAL %1: signal received while waiting for next packet This debug message is issued when the server was waiting for the packet, but the wait has been interrupted by the signal received by the process. The signal will be handled before the server starts @@ -299,7 +299,7 @@ should plan your strategy to stop using it soon. This warning message is displayed when the version is a development (vs stable) one: the second number of the version is odd. -% DHCP4_DHCP4O6_BAD_PACKET received malformed DHCPv4o6 packet: %1 +% DHCP4_DHCP4O6_BAD_PACKET %1: received malformed DHCPv4o6 packet: %2 A malformed DHCPv4o6 packet was received. % DHCP4_DHCP4O6_HOOK_SUBNET4_SELECT_DROP %1: packet was dropped, because a callout set the next step to 'drop' @@ -318,7 +318,7 @@ will be only able to offer global options - no addresses will be assigned. The argument specifies the client and transaction identification information. -% DHCP4_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv4 server (type %1) for %2 on interface %3 +% DHCP4_DHCP4O6_PACKET_RECEIVED %1: received DHCPv4o6 packet from DHCPv4 server (type %2) for %3 on interface %4 This debug message is printed when the server is receiving a DHCPv4o6 from the DHCPv4 server over inter-process communication. @@ -333,7 +333,7 @@ This error is output if the IPv4 DHCP server fails to send an DHCPv4o6 message to the IPv6 DHCP server. The reason for the error is included in the message. -% DHCP4_DHCP4O6_RECEIVE_FAIL failed to receive DHCPv4o6: %1 +% DHCP4_DHCP4O6_RECEIVE_FAIL %1: failed to receive DHCPv4o6: %2 This debug message indicates the inter-process communication with the DHCPv6 server failed. The reason for the error is included in the message. @@ -398,7 +398,7 @@ from a client. Server does not process empty Hostname options and therefore option is skipped. The argument holds the client and transaction identification information. -% DHCP4_FLEX_ID flexible identifier generated for incoming packet: %1 +% DHCP4_FLEX_ID %1: flexible identifier generated for incoming packet: %2 This debug message is printed when host reservation type is set to flexible identifier and the expression specified in its configuration generated (was evaluated to) an identifier for incoming packet. This debug message is mainly intended as a @@ -783,13 +783,13 @@ This error message is issued when preparing an on-wire format of the packet has failed. The first argument identifies the client and the DHCP transaction. The second argument includes the error string. -% DHCP4_PACKET_PROCESS_EXCEPTION exception occurred during packet processing +% DHCP4_PACKET_PROCESS_EXCEPTION %1: exception occurred during packet processing This error message indicates that a non-standard exception was raised during packet processing that was not caught by other, more specific exception handlers. This packet will be dropped and the server will continue operation. -% DHCP4_PACKET_PROCESS_STD_EXCEPTION exception occurred during packet processing: %1 +% DHCP4_PACKET_PROCESS_STD_EXCEPTION %1: exception occurred during packet processing: %2 This error message indicates that a standard exception was raised during packet processing that was not caught by other, more specific exception handlers. This packet will be dropped and the server will @@ -1115,6 +1115,3 @@ The second argument contains the IPv4 address in the ciaddr field. The third argument contains the IPv4 address in the requested-ip-address option (if present). -% DHCP6_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv6 server (type %1) for %2 port %3 on interface %4 -This debug message is printed when the server is receiving a DHCPv4o6 -from the DHCPv6 server over inter-process communication. diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 090bfbbbb1..266a37b12a 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -486,6 +486,7 @@ Dhcpv4Exchange::setHostIdentifiers(AllocEngine::ClientContext4Ptr context) { !id.empty()) { LOG_DEBUG(packet4_logger, DBGLVL_TRACE_BASIC, DHCP4_FLEX_ID) + .arg(context->query_->getLabel()) .arg(Host::getIdentifierAsText(type, &id[0], id.size())); context->addHostIdentifier(type, id); @@ -1136,12 +1137,14 @@ Dhcpv4Srv::run() { // General catch-all exception that are not caught by more specific // catches. This one is for exceptions derived from std::exception. LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_STD_EXCEPTION) + .arg("[no hwaddr info], cid=[no info], tid=[no info]") .arg(e.what()); } catch (...) { // General catch-all exception that are not caught by more specific // catches. This one is for other exceptions, not derived from // std::exception. - LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION) + .arg("[no hwaddr info], cid=[no info], tid=[no info]"); } } @@ -1158,6 +1161,7 @@ void Dhcpv4Srv::runOne() { // client's message and server's response Pkt4Ptr query; + string label = "[no hwaddr info], cid=[no info], tid=[no info]"; try { // Set select() timeout to 1s. This value should not be modified @@ -1173,7 +1177,9 @@ Dhcpv4Srv::runOne() { // point are: the interface, source address and destination addresses // and ports. if (query) { + label = query->getLabel(); LOG_DEBUG(packet4_logger, DBG_DHCP4_BASIC, DHCP4_BUFFER_RECEIVED) + .arg(label) .arg(query->getRemoteAddr().toText()) .arg(query->getRemotePort()) .arg(query->getLocalAddr().toText()) @@ -1193,10 +1199,13 @@ Dhcpv4Srv::runOne() { // SIGINT, SIGHUP or SIGCHLD which are handled by the server. For // signals that are not handled by the server we rely on the default // behavior of the system. - LOG_DEBUG(packet4_logger, DBG_DHCP4_DETAIL, DHCP4_BUFFER_WAIT_SIGNAL); + LOG_DEBUG(packet4_logger, DBG_DHCP4_DETAIL, DHCP4_BUFFER_WAIT_SIGNAL) + .arg(label); } catch (const std::exception& e) { // Log all other errors. - LOG_ERROR(packet4_logger, DHCP4_BUFFER_RECEIVE_FAIL).arg(e.what()); + LOG_ERROR(packet4_logger, DHCP4_BUFFER_RECEIVE_FAIL) + .arg(label) + .arg(e.what()); } // Timeout may be reached or signal received, which breaks select() @@ -1233,9 +1242,10 @@ Dhcpv4Srv::processPacketAndSendResponseNoThrow(Pkt4Ptr query) { processPacketAndSendResponse(query); } catch (const std::exception& e) { LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_STD_EXCEPTION) + .arg(query->getLabel()) .arg(e.what()); } catch (...) { - LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION).arg(query->getLabel()); } } @@ -1450,9 +1460,10 @@ Dhcpv4Srv::processDhcp4QueryAndSendResponse(Pkt4Ptr query, processPacketBufferSend(callout_handle, rsp); } catch (const std::exception& e) { LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_STD_EXCEPTION) + .arg(query->getLabel()) .arg(e.what()); } catch (...) { - LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION).arg(query->getLabel()); } } @@ -1528,9 +1539,10 @@ Dhcpv4Srv::processLocalizedQuery4AndSendResponse(Pkt4Ptr query, processPacketBufferSend(callout_handle, rsp); } catch (const std::exception& e) { LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_STD_EXCEPTION) + .arg(query->getLabel()) .arg(e.what()); } catch (...) { - LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION).arg(query->getLabel()); } } @@ -1797,9 +1809,10 @@ Dhcpv4Srv::sendResponseNoThrow(hooks::CalloutHandlePtr& callout_handle, processPacketBufferSend(callout_handle, rsp); } catch (const std::exception& e) { LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_STD_EXCEPTION) + .arg(query->getLabel()) .arg(e.what()); } catch (...) { - LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION).arg(query->getLabel()); } } @@ -4249,7 +4262,7 @@ Dhcpv4Srv::serverDeclineNoThrow(hooks::CalloutHandlePtr& callout_handle, Pkt4Ptr try { serverDecline(callout_handle, query, lease, lease_exists); } catch (...) { - LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet4_logger, DHCP4_PACKET_PROCESS_EXCEPTION).arg(query->getLabel()); } } diff --git a/src/bin/dhcp4/dhcp4to6_ipc.cc b/src/bin/dhcp4/dhcp4to6_ipc.cc index 717552d100..889fe5ba50 100644 --- a/src/bin/dhcp4/dhcp4to6_ipc.cc +++ b/src/bin/dhcp4/dhcp4to6_ipc.cc @@ -55,6 +55,7 @@ void Dhcp4to6Ipc::open() { void Dhcp4to6Ipc::handler(int /* fd */) { Dhcp4to6Ipc& ipc = Dhcp4to6Ipc::instance(); Pkt6Ptr pkt; + string label = "[no hwaddr info], cid=[no info], tid=[no info]"; try { LOG_DEBUG(packet4_logger, DBG_DHCP4_DETAIL, DHCP4_DHCP4O6_RECEIVING); @@ -63,7 +64,9 @@ void Dhcp4to6Ipc::handler(int /* fd */) { // From Dhcpv4Srv::runOne() after receivePacket() if (pkt) { + label = pkt->getLabel(); LOG_DEBUG(packet4_logger, DBG_DHCP4_BASIC, DHCP4_DHCP4O6_PACKET_RECEIVED) + .arg(label) .arg(static_cast(pkt->getType())) .arg(pkt->getRemoteAddr().toText()) .arg(pkt->getRemotePort()) @@ -71,6 +74,7 @@ void Dhcp4to6Ipc::handler(int /* fd */) { } } catch (const std::exception& e) { LOG_DEBUG(packet4_logger, DBG_DHCP4_DETAIL, DHCP4_DHCP4O6_RECEIVE_FAIL) + .arg(label) .arg(e.what()); } @@ -82,10 +86,12 @@ void Dhcp4to6Ipc::handler(int /* fd */) { OptionCollection msgs = pkt->getOptions(D6O_DHCPV4_MSG); if (msgs.empty()) { LOG_DEBUG(packet4_logger, DBG_DHCP4_DETAIL, DHCP4_DHCP4O6_BAD_PACKET) + .arg(pkt->getLabel()) .arg("DHCPv4 message option not present"); return; } else if (msgs.size() > 1) { LOG_DEBUG(packet4_logger, DBG_DHCP4_DETAIL, DHCP4_DHCP4O6_BAD_PACKET) + .arg(pkt->getLabel()) .arg("more than one DHCPv4 message option"); return; } @@ -94,6 +100,7 @@ void Dhcp4to6Ipc::handler(int /* fd */) { OptionPtr msg = msgs.begin()->second; if (!msg) { LOG_DEBUG(packet4_logger, DBG_DHCP4_DETAIL, DHCP4_DHCP4O6_BAD_PACKET) + .arg(pkt->getLabel()) .arg("null DHCPv4 message option"); return; } diff --git a/src/bin/dhcp6/dhcp6_messages.mes b/src/bin/dhcp6/dhcp6_messages.mes index c2ae90127e..99ec3a5fd7 100644 --- a/src/bin/dhcp6/dhcp6_messages.mes +++ b/src/bin/dhcp6/dhcp6_messages.mes @@ -42,7 +42,7 @@ the server. In such an event, it would be necessary to manually remove the PID file. The first argument is the DHCPv6 process name, the second contains the PID and PID file. -% DHCP6_BUFFER_RECEIVED received buffer from %1:%2 to %3:%4 over interface %5 +% DHCP6_BUFFER_RECEIVED %1: received buffer from %2:%3 to %4:%5 over interface %6 This debug message is logged when the server has received a packet over the socket. When the message is logged the contents of the received packet hasn't been parsed yet. The only available information is the @@ -54,7 +54,7 @@ buffer holding the DHCPv6 message. The arguments specify the source and destination addresses as well as the interface over which the buffer has been received. -% DHCP6_BUFFER_WAIT_SIGNAL signal received while waiting for next packet +% DHCP6_BUFFER_WAIT_SIGNAL %1: signal received while waiting for next packet This debug message is issued when the server was waiting for the packet, but the wait has been interrupted by the signal received by the process. The signal will be handled before the server starts @@ -321,11 +321,11 @@ should plan your strategy to stop using it soon. This warning message is displayed when the version is a development (vs stable) one: the second number of the version is odd. -% DHCP6_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv4 server (type %1) for %2 port %3 on interface %4 +% DHCP6_DHCP4O6_PACKET_RECEIVED %1: received DHCPv4o6 packet from DHCPv4 server (type %2) for %3 port %4 on interface %5 This debug message is printed when the server is receiving a DHCPv4o6 from the DHCPv4 server over inter-process communication. -% DHCP6_DHCP4O6_RECEIVE_FAIL failed to receive DHCPv4o6: %1 +% DHCP6_DHCP4O6_RECEIVE_FAIL %1: failed to receive DHCPv4o6: %2 This debug message indicates the inter-process communication with the DHCPv4 server failed. The reason for the error is included in the message. @@ -341,7 +341,7 @@ identification information. The second and third argument contains the packet name and type respectively. The fourth argument contains detailed packet information. -% DHCP6_DHCP4O6_SEND_FAIL failed to send DHCPv4o6 packet: %1 +% DHCP6_DHCP4O6_SEND_FAIL %1: failed to send DHCPv4o6 packet: %2 This error is output if the IPv6 DHCP server fails to send an assembled DHCPv4o6 message to a client. The reason for the error is included in the message. @@ -358,7 +358,7 @@ DHCP server failed. This is info message logged when the dynamic reconfiguration of the DHCP server succeeded. -% DHCP6_FLEX_ID flexible identifier generated for incoming packet: %1 +% DHCP6_FLEX_ID %1: flexible identifier generated for incoming packet: %2 This debug message is printed when host reservation type is set to flexible identifier and the expression specified in its configuration generated (was evaluated to) an identifier for incoming packet. This debug message is mainly intended as a @@ -652,7 +652,7 @@ A debug message issued when an option failed to unpack correctly, making it impossible to unpack the remaining options in the packet. The server will server will still attempt to service the packet. -% DHCP6_PACKET_PROCESS_EXCEPTION exception occurred during packet processing +% DHCP6_PACKET_PROCESS_EXCEPTION %1: exception occurred during packet processing This error message indicates that a non-standard exception was raised during packet processing that was not caught by other, more specific exception handlers. This packet will be dropped and the server will @@ -663,7 +663,7 @@ This is a general catch-all message indicating that the processing of the specified packet type from the indicated address failed. The reason is given in the message. The server will not send a response but will instead ignore the packet. -% DHCP6_PACKET_PROCESS_STD_EXCEPTION exception occurred during packet processing: %1 +% DHCP6_PACKET_PROCESS_STD_EXCEPTION %1: exception occurred during packet processing: %2 This error message indicates that a standard exception was raised during packet processing that was not caught by other, more specific exception handlers. This packet will be dropped and the server will @@ -682,7 +682,7 @@ respectively. The remaining arguments specify the source address, destination IP address and the name of the interface on which the message has been received. -% DHCP6_PACKET_RECEIVE_FAIL error on attempt to receive packet: %1 +% DHCP6_PACKET_RECEIVE_FAIL %1: error on attempt to receive packet: %2 The IPv6 DHCP server tried to receive a packet but an error occurred during this attempt. The reason for the error is included in the message. @@ -693,7 +693,7 @@ and client identifier), DHCP message name and type, source IPv6 address and port, destination IPv6 address and port and the interface name. -% DHCP6_PACKET_SEND_FAIL failed to send DHCPv6 packet: %1 +% DHCP6_PACKET_SEND_FAIL %1: failed to send DHCPv6 packet: %2 This error is output if the IPv6 DHCP server fails to send an assembled DHCP message to a client. The reason for the error is included in the message. diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 33921338ac..eff146b8f6 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -412,6 +412,7 @@ Dhcpv6Srv::setHostIdentifiers(AllocEngine::ClientContext6& ctx) { !id.empty()) { LOG_DEBUG(packet6_logger, DBGLVL_TRACE_BASIC, DHCP6_FLEX_ID) + .arg(ctx.query_->getLabel()) .arg(Host::getIdentifierAsText(type, &id[0], id.size())); ctx.addHostIdentifier(type, id); @@ -617,12 +618,14 @@ Dhcpv6Srv::run() { // General catch-all standard exceptions that are not caught by more // specific catches. LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_STD_EXCEPTION) + .arg("duid=[no info], [no hwaddr info], tid=[no info]") .arg(e.what()); } catch (...) { // General catch-all non-standard exception that are not caught // by more specific catches. - LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION) + .arg("duid=[no info], [no hwaddr info], tid=[no info]"); } } @@ -639,6 +642,7 @@ void Dhcpv6Srv::runOne() { // client's message and server's response Pkt6Ptr query; + string label = "duid=[no info], [no hwaddr info], tid=[no info]"; try { // Set select() timeout to 1s. This value should not be modified @@ -654,7 +658,9 @@ Dhcpv6Srv::runOne() { // point are: the interface, source address and destination addresses // and ports. if (query) { + label = query->getLabel(); LOG_DEBUG(packet6_logger, DBG_DHCP6_BASIC, DHCP6_BUFFER_RECEIVED) + .arg(label) .arg(query->getRemoteAddr().toText()) .arg(query->getRemotePort()) .arg(query->getLocalAddr().toText()) @@ -680,9 +686,11 @@ Dhcpv6Srv::runOne() { // SIGINT, SIGHUP or SIGCHLD which are handled by the server. For // signals that are not handled by the server we rely on the default // behavior of the system. - LOG_DEBUG(packet6_logger, DBG_DHCP6_DETAIL, DHCP6_BUFFER_WAIT_SIGNAL); + LOG_DEBUG(packet6_logger, DBG_DHCP6_DETAIL, DHCP6_BUFFER_WAIT_SIGNAL).arg(label); } catch (const std::exception& e) { - LOG_ERROR(packet6_logger, DHCP6_PACKET_RECEIVE_FAIL).arg(e.what()); + LOG_ERROR(packet6_logger, DHCP6_PACKET_RECEIVE_FAIL) + .arg(label) + .arg(e.what()); } // Timeout may be reached or signal received, which breaks select() @@ -718,9 +726,11 @@ Dhcpv6Srv::processPacketAndSendResponseNoThrow(Pkt6Ptr query) { processPacketAndSendResponse(query); } catch (const std::exception& e) { LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_STD_EXCEPTION) + .arg(query->getLabel()) .arg(e.what()); } catch (...) { - LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION) + .arg(query->getLabel()); } } @@ -949,9 +959,11 @@ Dhcpv6Srv::processDhcp6QueryAndSendResponse(Pkt6Ptr query) { processPacketBufferSend(callout_handle, rsp); } catch (const std::exception& e) { LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_STD_EXCEPTION) + .arg(query->getLabel()) .arg(e.what()); } catch (...) { - LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION) + .arg(query->getLabel()); } } @@ -1014,9 +1026,11 @@ Dhcpv6Srv::processLocalizedQuery6AndSendResponse(Pkt6Ptr query, processPacketBufferSend(callout_handle, rsp); } catch (const std::exception& e) { LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_STD_EXCEPTION) + .arg(query->getLabel()) .arg(e.what()); } catch (...) { - LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION) + .arg(query->getLabel()); } } @@ -1307,9 +1321,11 @@ Dhcpv6Srv::sendResponseNoThrow(hooks::CalloutHandlePtr& callout_handle, processPacketBufferSend(callout_handle, rsp); } catch (const std::exception& e) { LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_STD_EXCEPTION) + .arg(query->getLabel()) .arg(e.what()); } catch (...) { - LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION); + LOG_ERROR(packet6_logger, DHCP6_PACKET_PROCESS_EXCEPTION) + .arg(query->getLabel()); } } @@ -1449,7 +1465,9 @@ Dhcpv6Srv::processPacketBufferSend(CalloutHandlePtr& callout_handle, processStatsSent(rsp); } catch (const std::exception& e) { - LOG_ERROR(packet6_logger, DHCP6_PACKET_SEND_FAIL).arg(e.what()); + LOG_ERROR(packet6_logger, DHCP6_PACKET_SEND_FAIL) + .arg(rsp->getLabel()) + .arg(e.what()); } } diff --git a/src/bin/dhcp6/dhcp6to4_ipc.cc b/src/bin/dhcp6/dhcp6to4_ipc.cc index 6a1ca08abd..84e2a4eb78 100644 --- a/src/bin/dhcp6/dhcp6to4_ipc.cc +++ b/src/bin/dhcp6/dhcp6to4_ipc.cc @@ -57,6 +57,7 @@ void Dhcp6to4Ipc::open() { void Dhcp6to4Ipc::handler(int /* fd */) { Dhcp6to4Ipc& ipc = Dhcp6to4Ipc::instance(); Pkt6Ptr pkt; + string label = "duid=[no info], [no hwaddr info], tid=[no info]"; try { LOG_DEBUG(packet6_logger, DBG_DHCP6_DETAIL, DHCP6_DHCP4O6_RECEIVING); @@ -64,7 +65,9 @@ void Dhcp6to4Ipc::handler(int /* fd */) { pkt = ipc.receive(); if (pkt) { + label = pkt->getLabel(); LOG_DEBUG(packet6_logger, DBG_DHCP6_BASIC, DHCP6_DHCP4O6_PACKET_RECEIVED) + .arg(label) .arg(static_cast(pkt->getType())) .arg(pkt->getRemoteAddr().toText()) .arg(pkt->getRemotePort()) @@ -72,6 +75,7 @@ void Dhcp6to4Ipc::handler(int /* fd */) { } } catch (const std::exception& e) { LOG_DEBUG(packet6_logger,DBG_DHCP6_DETAIL, DHCP6_DHCP4O6_RECEIVE_FAIL) + .arg(label) .arg(e.what()); } @@ -158,7 +162,9 @@ void Dhcp6to4Ipc::handler(int /* fd */) { Dhcpv6Srv::processStatsSent(pkt); } catch (const std::exception& e) { - LOG_ERROR(packet6_logger, DHCP6_DHCP4O6_SEND_FAIL).arg(e.what()); + LOG_ERROR(packet6_logger, DHCP6_DHCP4O6_SEND_FAIL) + .arg(pkt->getLabel()) + .arg(e.what()); } } -- cgit v1.2.3