]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1374 in SNORT/snort3 from reload_module_fix to master
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Mon, 8 Oct 2018 13:28:08 +0000 (09:28 -0400)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Mon, 8 Oct 2018 13:28:08 +0000 (09:28 -0400)
Squashed commit of the following:

commit 721f5381733609f3fcf65a5689b50323424fd06a
Author: Silviu Minut <sminut@cisco.com>
Date:   Thu Sep 27 11:32:00 2018 -0400

    main: initialize shell_map and other maps in PolicyMap::clone(). Some pointers need to be updated during reloads based on some map lookups, which would fail quietly if those maps are not initialized during clone.

src/main/policy.cc

index 07e1cda0235c5184b61e45addeeeca5d50396599..c4036fe85db20c13432e1e5ec6683314ddb1f451 100644 (file)
@@ -192,6 +192,27 @@ void PolicyMap::clone(PolicyMap *other_map)
         else
             inspection_policy.push_back(other_map->inspection_policy[i]);
     }
+
+    shell_map = other_map->shell_map;
+
+    // Fix references to inspection_policy[0]
+    for ( auto p : other_map->shell_map )
+    {
+        if ( p.second->inspection == other_map->inspection_policy[0] )
+            shell_map[p.first]->inspection = inspection_policy[0];
+    }
+
+    user_inspection = other_map->user_inspection;
+
+    // Fix references to inspection_policy[0]
+    for ( auto p : other_map->user_inspection )
+    {
+        if ( p.second == other_map->inspection_policy[0] )
+            user_inspection[p.first] = inspection_policy[0];
+    }
+
+    user_ips = other_map->user_ips;
+    user_network = other_map->user_network;
 }
 
 unsigned PolicyMap::add_inspection_shell(Shell* sh)