]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2820] add tid in some packets logs
authorPiotrek Zadroga <piotrek@isc.org>
Thu, 25 Apr 2024 14:12:51 +0000 (16:12 +0200)
committerPiotrek Zadroga <piotrek@isc.org>
Fri, 26 Apr 2024 12:42:46 +0000 (14:42 +0200)
src/bin/dhcp4/dhcp4_messages.cc
src/bin/dhcp4/dhcp4_messages.h
src/bin/dhcp4/dhcp4_messages.mes
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp4/dhcp4to6_ipc.cc
src/bin/dhcp6/dhcp6_messages.mes
src/bin/dhcp6/dhcp6_srv.cc
src/bin/dhcp6/dhcp6to4_ipc.cc

index 187bfc65e13e50c28cd731e352337d4c95ba0361..3a556e9e51d95458ad07cf75e70d958c6e5181d5 100644 (file)
@@ -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
 };
 
index 79c5631acda4f50b642b91b4de6193b8fece4a66..3b4f25c51a3f5c48d223282047dd950bed09f8d7 100644 (file)
@@ -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
index 2cd097675d24271fd70973f9337649fd4bea060a..1c50bb8fcc747917a00c47c75c688503a9c33a6e 100644 (file)
@@ -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.
index 090bfbbbb127b8353e6a546d6437692ff56dea6b..266a37b12a9ee1e3956ff3daa187e3711abc39bf 100644 (file)
@@ -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());
     }
 }
 
index 717552d100325f41eeee10d676c1ffee6c1c0ef3..889fe5ba505d568170bce458eab9ed96d3ac71e2 100644 (file)
@@ -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<int>(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;
     }
index c2ae90127e4c27da6805975407193ce6dc4e58b4..99ec3a5fd765b101175b226c6f3cf89e469aa11a 100644 (file)
@@ -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.
index 33921338acd918dc84303396ed7516b996f0306b..eff146b8f6088b8e03a9fed0c01d1c96563f1317 100644 (file)
@@ -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());
     }
 }
 
index 6a1ca08abd5e76e57462a8e68634ba19cd914c4e..84e2a4eb78a669fa43138e5c7e0c28eb3293e444 100644 (file)
@@ -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<int>(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());
     }
 }