]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4835: file_api: multi-process snort file cache crash fix
authorShilpa Nagpal (shinagpa) <shinagpa@cisco.com>
Thu, 31 Jul 2025 12:14:35 +0000 (12:14 +0000)
committerLokesh Bevinamarad (lbevinam) <lbevinam@cisco.com>
Thu, 31 Jul 2025 12:14:35 +0000 (12:14 +0000)
Merge in SNORT/snort3 from ~SHINAGPA/snort3:mp_file_fix to master

Squashed commit of the following:

commit b72873ff0d9785dad40e2fd293aab1c697b10c06
Author: Shilpa Nagpal <shinagpa@cisco.com>
Date:   Mon Jul 28 16:17:08 2025 +0530

    file_api: multi-process snort file cache crash fix

src/file_api/file_cache.cc
src/file_api/file_flows.cc

index 90589e3df2b851decca6439a947674f6664aca3f..0ba4e7b497a9d3a17aeaba0ee623583aa106c421 100644 (file)
@@ -276,6 +276,11 @@ FileContext* FileCache::get_file(Flow* flow, uint64_t file_id, bool to_create,
     if (to_create and !file)
         file = add(hashKey, timeout, cache_full, cache_expire);
 
+    if (file and !file->get_config())
+    {
+        FileConfig *fc = get_file_config(SnortConfig::get_conf());  
+        file->set_config(fc);
+    }
     return file;
 }
 
index 62b90d07f6c7862bd5d8589db5c83e0564d31e3c..de855e5bb53d035ae78a0e5dacebaaef0a7930f4 100644 (file)
@@ -276,13 +276,6 @@ FileContext* FileFlows::get_file_context(
         FileCache* file_cache = FileService::get_file_cache();
         assert(file_cache);
         context = file_cache->get_file(flow, file_id, false, true);
-        if (context)
-        {
-            FileConfig *fc = get_file_config(SnortConfig::get_conf());  
-            
-            if (!context->get_config())
-                context->set_config(fc);
-        }
         FILE_DEBUG(file_trace, DEFAULT_TRACE_OPTION_ID, TRACE_DEBUG_LEVEL, GET_CURRENT_PACKET,
             "get_file_context:trying to get context from cache\n");
     }