]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1132 in SNORT/snort3 from reload_hosts_fix to master
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Mon, 12 Mar 2018 20:56:01 +0000 (16:56 -0400)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Mon, 12 Mar 2018 20:56:01 +0000 (16:56 -0400)
Squashed commit of the following:

commit 16f4f9ca6b73b5bee41ff8700001c4bece5ec880
Author: Bhagya Tholpady <bbantwal@cisco.com>
Date:   Wed Mar 7 13:43:16 2018 -0500

    main: reload hosts while reloading config

src/main.cc
src/main/swapper.cc
src/main/swapper.h

index 0119052af2691f18e82235b3f28a519d587b298b..8287a59ef188738926add3b1e622dea05082833e 100644 (file)
@@ -322,12 +322,21 @@ int main_reload_config(lua_State* L)
         current_request->respond("== reload failed\n");
         return 0;
     }
+
+    tTargetBasedConfig* old_tc = SFAT_GetConfig();
+    tTargetBasedConfig* tc = SFAT_Swap();
+
+    if ( !tc )
+    {
+        current_request->respond("== reload failed\n");
+        return 0;
+    }
     SnortConfig::set_conf(sc);
     proc_stats.conf_reloads++;
 
     bool from_shell = ( L != nullptr );
     current_request->respond(".. swapping configuration\n", from_shell);
-    main_broadcast_command(get_command(new ACSwap(new Swapper(old, sc)), from_shell));
+    main_broadcast_command(get_command(new ACSwap(new Swapper(old, sc, old_tc, tc)), from_shell));
 
     return 0;
 }
index e17f6dd9eba9b85a7c66039b81228a45511a8a44..2b7b14cbc8c35adbb900b293907d2c74c322f2f6 100644 (file)
@@ -47,6 +47,15 @@ Swapper::Swapper(SnortConfig* sold, SnortConfig* snew)
     new_attribs = nullptr;
 }
 
+Swapper::Swapper(SnortConfig* sold, SnortConfig* snew, tTargetBasedConfig* told, tTargetBasedConfig* tnew)
+{
+    old_conf = sold;
+    new_conf = snew;
+
+    old_attribs = told;
+    new_attribs = tnew;
+}
+
 Swapper::Swapper(tTargetBasedConfig* told, tTargetBasedConfig* tnew)
 {
     old_conf = nullptr;
index e33f02b405592d6840c2b81fce6b57ca417491ad..b92cb39b7c425ebfd88bfb79d57aad7d3948bf43 100644 (file)
@@ -30,6 +30,7 @@ class Swapper
 public:
     Swapper(SnortConfig*, tTargetBasedConfig*);
     Swapper(SnortConfig*, SnortConfig*);
+    Swapper(SnortConfig*, SnortConfig*, tTargetBasedConfig*, tTargetBasedConfig*);
     Swapper(tTargetBasedConfig*, tTargetBasedConfig*);
     ~Swapper();