From: Tomek Mrugalski Date: Mon, 7 Dec 2015 16:51:20 +0000 (+0100) Subject: [4206_0.9.2] fix for empty client-id in v4 X-Git-Tag: Kea-0.9.2-P1~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22ad0ddba8a96443b04bcc60f3f68679920937fb;p=thirdparty%2Fkea.git [4206_0.9.2] fix for empty client-id in v4 --- diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index f8e471bbdb..fc992a09c0 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -429,6 +429,11 @@ 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: %1 +This error message indicates that an 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_RECEIVED %1: %2 (type %3) received from %4 to %5 on interface %6 A debug message noting that the server has received the specified type of packet on the specified interface. The first argument specifies the diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 6ade319bd7..1bdfc9a58e 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -357,6 +357,8 @@ Dhcpv4Srv::run() { Pkt4Ptr query; Pkt4Ptr rsp; + try { + try { // The lease database backend may install some timers for which // the handlers need to be executed periodically. Retrieve the @@ -716,6 +718,20 @@ Dhcpv4Srv::run() { .arg(rsp->getLabel()) .arg(e.what()); } + + } catch (const std::exception& e) { + // 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_EXCEPTION) + .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) + .arg("an unknown exception not derived from std::exception"); + } + } return (true);