|
@@ -417,7 +417,6 @@ Dhcpv4Srv::run() {
|
|
|
while (!shutdown_) {
|
|
|
// client's message and server's response
|
|
|
Pkt4Ptr query;
|
|
|
- Pkt4Ptr rsp;
|
|
|
|
|
|
try {
|
|
|
|
|
@@ -484,6 +483,29 @@ Dhcpv4Srv::run() {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
+ processPacket(query);
|
|
|
+
|
|
|
+ } 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);
|
|
|
+}
|
|
|
+
|
|
|
+void
|
|
|
+Dhcpv4Srv::processPacket(Pkt4Ptr& query) {
|
|
|
+ Pkt4Ptr rsp;
|
|
|
+
|
|
|
// Log reception of the packet. We need to increase it early, as any
|
|
|
// failures in unpacking will cause the packet to be dropped. We
|
|
|
// will increase type specific packets further down the road.
|
|
@@ -557,7 +579,7 @@ Dhcpv4Srv::run() {
|
|
|
static_cast<int64_t>(1));
|
|
|
isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
|
|
|
static_cast<int64_t>(1));
|
|
|
- continue;
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -575,7 +597,7 @@ Dhcpv4Srv::run() {
|
|
|
// Increase the statistic of dropped packets.
|
|
|
isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
|
|
|
static_cast<int64_t>(1));
|
|
|
- continue;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
// We have sanity checked (in accept() that the Message Type option
|
|
@@ -612,7 +634,7 @@ Dhcpv4Srv::run() {
|
|
|
if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP) {
|
|
|
LOG_DEBUG(hooks_logger, DBG_DHCP4_HOOKS, DHCP4_HOOK_PACKET_RCVD_SKIP)
|
|
|
.arg(query->getLabel());
|
|
|
- continue;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
/// @todo: Add support for DROP status
|
|
@@ -671,7 +693,7 @@ Dhcpv4Srv::run() {
|
|
|
}
|
|
|
|
|
|
if (!rsp) {
|
|
|
- continue;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -747,7 +769,7 @@ Dhcpv4Srv::run() {
|
|
|
LOG_DEBUG(hooks_logger, DBG_DHCP4_HOOKS,
|
|
|
DHCP4_HOOK_BUFFER_SEND_SKIP)
|
|
|
.arg(rsp->getLabel());
|
|
|
- continue;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
/// @todo: Add support for DROP status.
|
|
@@ -781,22 +803,6 @@ 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);
|
|
|
}
|
|
|
|
|
|
string
|