From: Sreeja Athirkandathil Narayanan Date: Tue, 2 Aug 2022 17:54:37 +0000 (-0400) Subject: appid: activate appid debug object before printing logs from http event handler X-Git-Tag: 3.1.40.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d9c921be114517251c349ef433cfa1823054c55;p=thirdparty%2Fsnort3.git appid: activate appid debug object before printing logs from http event handler --- diff --git a/src/network_inspectors/appid/appid_http_event_handler.cc b/src/network_inspectors/appid/appid_http_event_handler.cc index a5cdf5ab9..661f2eaf1 100644 --- a/src/network_inspectors/appid/appid_http_event_handler.cc +++ b/src/network_inspectors/appid/appid_http_event_handler.cc @@ -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());