]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
appid: activate appid debug object before printing logs from http event handler
authorSreeja Athirkandathil Narayanan <sathirka@cisco.com>
Tue, 2 Aug 2022 17:54:37 +0000 (13:54 -0400)
committerSreeja Athirkandathil Narayanan <sathirka@cisco.com>
Mon, 15 Aug 2022 20:20:14 +0000 (16:20 -0400)
src/network_inspectors/appid/appid_http_event_handler.cc

index a5cdf5ab97f480954df5770a1a6ba6b85ff39f3d..661f2eaf11c9ac6a4760595afdc8a00bb783d224 100644 (file)
@@ -49,6 +49,7 @@ void HttpEventHandler::handle(DataEvent& event, Flow* flow)
     Packet* p = DetectionEngine::get_current_packet();
     assert(p);
     auto direction = event_type == REQUEST_EVENT ? APP_ID_FROM_INITIATOR : APP_ID_FROM_RESPONDER;
+    bool is_debug_active = false;
 
     if ( !asd )
     {
@@ -61,6 +62,7 @@ void HttpEventHandler::handle(DataEvent& event, Flow* flow)
             if ( appidDebug->is_active() )
                 LogMessage("AppIdDbg %s New AppId session at HTTP event\n",
                     appidDebug->get_debug_session());
+            is_debug_active = true;
         }
     }
     else if ( asd->get_odp_ctxt_version() != pkt_thread_odp_ctxt->get_version() )
@@ -77,6 +79,9 @@ void HttpEventHandler::handle(DataEvent& event, Flow* flow)
         !http_event->get_is_http2())
         return;
 
+    if (appidDebug->is_enabled() and !is_debug_active)
+        appidDebug->activate(flow, asd, inspector.get_ctxt().config.log_all_sessions);
+
     if (appidDebug->is_active())
         LogMessage("AppIdDbg %s Processing HTTP metadata from HTTP Inspector for stream %u\n",
             appidDebug->get_debug_session(), http_event->get_http2_stream_id());