]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
fixed conf slots
authorRuss Combs <rucombs@cisco.com>
Wed, 19 Nov 2014 21:36:46 +0000 (16:36 -0500)
committerRuss Combs <rucombs@cisco.com>
Wed, 19 Nov 2014 21:36:46 +0000 (16:36 -0500)
ChangeLog
doc/start.txt
src/ips_options/ips_pcre.cc
src/main/snort_config.h
src/managers/inspector_manager.cc

index a7175afc97fbef98b67b1077b86b1da4339c9bd0..463d7217034c8375932528c3909a266df877ca15 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,7 @@
 -- fixed norm module handling of tcp opts
 -- fixed ecn normalization
 -- fixed pm backtracking
+-- gak! - fixed conf slots
 
 127
 -- REG_TEST out logging tcp options for rebuilt packets to match snort bug
index a1ca1d5d1335ae68aaaf6b1d9a2b14ce2992c259..135ebad41c36e1ece0467e94f7e8ea291a6dd250 100644 (file)
@@ -45,7 +45,7 @@ Optional:
 
     mkdir -p /path/to/my_build
     cd /path/to/my_build
-    Cmake /path/to/Snort++
+    cmake /path/to/Snort++
 
 * An alternate method for building with Cmake and make is to run the
   configure_cmake.sh script.  It will automatically create and populate
@@ -58,7 +58,7 @@ Optional:
 
     mkdir -p /path/to/my_build
     cd /path/to/my_build
-    Cmake /path/to/Snort++ -G Xcode
+    cmake /path/to/Snort++ -G Xcode
 
 * An alternate method for building with Xcode is to run the
   configure_cmake.sh script.  It will automatically create and populate
index 54d53396e907bb44dac5588f1ba717e594ba6639..c8903ac3134e1b8ce61db79f1f68ee1021de44b4 100644 (file)
@@ -622,7 +622,7 @@ bool pcre_next(PcreData* pcre)
 
 void pcre_setup(SnortConfig* sc)
 {
-    for ( unsigned i = 0; i < get_instance_max(); ++i )
+    for ( unsigned i = 0; i < sc->num_slots; ++i )
     {
         SnortState* ss = sc->state + i;
         ss->pcre_ovector = (int *) SnortAlloc(s_ovector_max*sizeof(int));
@@ -631,7 +631,7 @@ void pcre_setup(SnortConfig* sc)
 
 void pcre_cleanup(SnortConfig* sc)
 {
-    for ( unsigned i = 0; i < get_instance_max(); ++i )
+    for ( unsigned i = 0; i < sc->num_slots; ++i )
     {
         SnortState* ss = sc->state + i;
 
index e7fb05ee6f84a14c4106d77bcd85020b3854fd00..f3e2910711729fd61e8b0281d3513491e87972cb 100644 (file)
@@ -283,6 +283,7 @@ struct SnortConfig
 #endif
 
     SnortState* state;
+    unsigned num_slots;
 
 #ifdef UNIT_TEST
     bool unit_test;
index 3054b4fc948ebc32d45d5dae872249905262cf96..41f0fb72e2218b9aaeb6b27b7fb352c04726a1ed 100644 (file)
@@ -71,11 +71,21 @@ struct PHGlobal
 struct PHClass
 {
     const InspectApi& api;
-    bool init;  // call pin->tinit()
-    bool term;  // call pin->tterm()
+    bool* init;  // call pin->tinit()
+    bool* term;  // call pin->tterm()
 
     PHClass(const InspectApi& p) : api(p)
-    { init = term = true; };
+    { 
+        init = new bool[get_instance_max()];
+        term = new bool[get_instance_max()];
+        for ( unsigned i = 0; i < get_instance_max(); ++i )
+            init[i] = term[i] = true;
+    }
+    ~PHClass()
+    {
+        delete[] init;
+        delete[] term;
+    }
 
     static bool comp (PHClass* a, PHClass* b)
     { return ( a->api.type < b->api.type ); };
@@ -478,12 +488,14 @@ void InspectorManager::thread_init(SnortConfig* sc)
 
     if ( pi && pi->framework_policy )
     {
+        unsigned slot = get_instance_id();
+
         for ( auto* p : pi->framework_policy->ilist )
-            if ( p->pp_class.init )
+            if ( p->pp_class.init[slot] )
             {
                 p->handler->tinit();
-                p->pp_class.init = false;
-                p->pp_class.term = true;
+                p->pp_class.init[slot] = false;
+                p->pp_class.term[slot] = true;
             }
     }
 }
@@ -496,12 +508,14 @@ void InspectorManager::thread_stop(SnortConfig*)
 
     if ( pi && pi->framework_policy )
     {
+        unsigned slot = get_instance_id();
+
         for ( auto* p : pi->framework_policy->ilist )
             if ( p->pp_class.term )
             {
                 p->handler->tterm();
-                p->pp_class.term = false;
-                p->pp_class.init = true;
+                p->pp_class.term[slot] = false;
+                p->pp_class.init[slot] = true;
             }
     }
 }