From: Russ Combs Date: Wed, 19 Nov 2014 21:36:46 +0000 (-0500) Subject: fixed conf slots X-Git-Tag: 3.0.0-233~1189^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dd54fb44d045386059445b9f018773dea92abfed;p=thirdparty%2Fsnort3.git fixed conf slots --- diff --git a/ChangeLog b/ChangeLog index a7175afc9..463d72170 100644 --- 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 diff --git a/doc/start.txt b/doc/start.txt index a1ca1d5d1..135ebad41 100644 --- a/doc/start.txt +++ b/doc/start.txt @@ -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 diff --git a/src/ips_options/ips_pcre.cc b/src/ips_options/ips_pcre.cc index 54d53396e..c8903ac31 100644 --- a/src/ips_options/ips_pcre.cc +++ b/src/ips_options/ips_pcre.cc @@ -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; diff --git a/src/main/snort_config.h b/src/main/snort_config.h index e7fb05ee6..f3e291071 100644 --- a/src/main/snort_config.h +++ b/src/main/snort_config.h @@ -283,6 +283,7 @@ struct SnortConfig #endif SnortState* state; + unsigned num_slots; #ifdef UNIT_TEST bool unit_test; diff --git a/src/managers/inspector_manager.cc b/src/managers/inspector_manager.cc index 3054b4fc9..41f0fb72e 100644 --- a/src/managers/inspector_manager.cc +++ b/src/managers/inspector_manager.cc @@ -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; } } }