From b0ca226cf0bcf5077a2c6b78e2cd2cf7d7af71b4 Mon Sep 17 00:00:00 2001 From: "Michael Altizer (mialtize)" Date: Mon, 9 Jul 2018 12:42:29 -0400 Subject: [PATCH] Merge pull request #1286 in SNORT/snort3 from offload_crash to master Squashed commit of the following: commit 53d14ee1015a9df4b133589bece240fb39d84179 Author: Carter Waxman Date: Mon Jul 2 17:07:55 2018 -0400 detection: don't offload when 0 threads are configured --- src/detection/detection_engine.cc | 6 ++++-- src/detection/regex_offload.h | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/detection/detection_engine.cc b/src/detection/detection_engine.cc index 599ab8a59..27ef5ab40 100644 --- a/src/detection/detection_engine.cc +++ b/src/detection/detection_engine.cc @@ -297,8 +297,10 @@ bool DetectionEngine::offload(Packet* p) { ContextSwitcher* sw = Snort::get_switcher(); - if ( p->type() != PktType::PDU or (p->dsize < SnortConfig::get_conf()->offload_limit) or - !sw->can_hold() ) + if ( p->type() != PktType::PDU or + p->dsize < SnortConfig::get_conf()->offload_limit or + !sw->can_hold() or + !offloader->available() ) { fp_local(p); return false; diff --git a/src/detection/regex_offload.h b/src/detection/regex_offload.h index 1802daab2..e12d21942 100644 --- a/src/detection/regex_offload.h +++ b/src/detection/regex_offload.h @@ -49,6 +49,9 @@ public: void stop(); + unsigned available() + { return idle.size(); } + unsigned count() { return busy.size(); } -- 2.47.3