From: Russ Combs Date: Wed, 23 Jul 2014 21:05:32 +0000 (-0400) Subject: fixed building w/o perfprofiling X-Git-Tag: 3.0.0-233~1438^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95dd6749e18fd1ead2633f99f77e0b6aa210267a;p=thirdparty%2Fsnort3.git fixed building w/o perfprofiling --- diff --git a/ChangeLog b/ChangeLog index c200aa2a5..df178f22f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 104 -- changed configure --with-libpcre-* to --with-pcre-* for consistency -- same for pcap (again!) +-- made ppm and perfprofiling disabled by default in configure.ac -- added stream_size and stream_reassemble ips options 103 diff --git a/configure.ac b/configure.ac index 44778fc99..5a8740d33 100644 --- a/configure.ac +++ b/configure.ac @@ -287,8 +287,8 @@ if test "x$enable_valgrind" = "xyes"; then fi AC_ARG_ENABLE(ppm, -[ --disable-ppm Disable packet/rule performance monitor], - enable_ppm="$enableval", enable_ppm="yes") +[ --enable-ppm Enable packet/rule performance monitor], + enable_ppm="$enableval", enable_ppm="no") if test "x$enable_ppm" = "xyes"; then AC_DEFINE(PPM_MGR, [1], [build ppm manager]) @@ -303,8 +303,8 @@ if test "x$enable_ppm_test" = "xyes"; then fi AC_ARG_ENABLE(perfprofiling, -[ --disable-perfprofiling Disable preprocessor and rule performance profiling], - enable_perfprofiling="$enableval", enable_perfprofiling="yes") +[ --enable-perfprofiling Enable preprocessor and rule performance profiling], + enable_perfprofiling="$enableval", enable_perfprofiling="no") if test "x$enable_perfprofiling" = "xyes"; then CPPFLAGS="$CPPFLAGS -DPERF_PROFILING" @@ -363,7 +363,7 @@ if test "x$enable_profile" = "xyes"; then fi AC_ARG_ENABLE(sourcefire, -[ --enable-sourcefire Enable Sourcefire specific build options, encompasing --enable-perfprofiling and --enable-ppm], +[ --enable-sourcefire Enable Sourcefire specific build options, including --enable-perfprofiling and --enable-ppm], enable_sourcefire="$enableval", enable_sourcefire="no") if test "x$enable_sourcefire" = "xyes"; then diff --git a/doc/tips.txt b/doc/tips.txt index 21ef0b0f7..ab047125a 100644 --- a/doc/tips.txt +++ b/doc/tips.txt @@ -73,7 +73,7 @@ The following pointers will help you get started: ./configure --enable-inline-init-failopen --enable-option-checking=fatal --enable-pthread --with-libpcap-includes=/usr/local/include - --with-libpcap-libraries=/usr/local/lib + --with-pcap-libraries=/usr/local/lib --with-dnet-includes=/usr/local/include --with-dnet-libraries=/usr/local/lib --enable-sourcefire --with-luajit-includes=/usr/local/include/luajit-2.0 diff --git a/src/ips_options/ips_pkt_data.cc b/src/ips_options/ips_pkt_data.cc index 6062f0142..da6b6e261 100644 --- a/src/ips_options/ips_pkt_data.cc +++ b/src/ips_options/ips_pkt_data.cc @@ -40,6 +40,7 @@ #include "framework/cursor.h" #include "framework/ips_option.h" #include "framework/module.h" +#include "detection/detection_defines.h" static const char* s_name = "pkt_data"; diff --git a/src/ips_options/ips_replace.cc b/src/ips_options/ips_replace.cc index f53dc607b..0457abb82 100644 --- a/src/ips_options/ips_replace.cc +++ b/src/ips_options/ips_replace.cc @@ -41,6 +41,7 @@ using namespace std; #include "framework/ips_option.h" #include "framework/parameter.h" #include "framework/module.h" +#include "detection/detection_defines.h" #define MAX_PATTERN_SIZE 2048 diff --git a/src/main/modules.cc b/src/main/modules.cc index d2eaefc3e..1333db781 100644 --- a/src/main/modules.cc +++ b/src/main/modules.cc @@ -1871,7 +1871,9 @@ void module_init() ModuleManager::add_module(new DetectionModule); ModuleManager::add_module(new PacketsModule); ModuleManager::add_module(new ProcessModule); +#ifdef PERF_PROFILING ModuleManager::add_module(new ProfileModule); +#endif ModuleManager::add_module(new ReferencesModule); ModuleManager::add_module(new RuleStateModule); ModuleManager::add_module(new SearchEngineModule); diff --git a/src/main/snort.cc b/src/main/snort.cc index 0dc8e66f8..870c1f209 100644 --- a/src/main/snort.cc +++ b/src/main/snort.cc @@ -232,6 +232,7 @@ static void restart() // FIXIT move these to appropriate modules //------------------------------------------------------------------------- +#ifdef PERF_PROFILING static ProfileStats* get_profile(const char* key) { if ( !strcmp(key, "detect") ) @@ -263,9 +264,11 @@ static ProfileStats* get_profile(const char* key) return nullptr; } +#endif static void register_profiles() { +#ifdef PERF_PROFILING RegisterProfile("detect", nullptr, get_profile); RegisterProfile("mpse", "detect", get_profile); RegisterProfile("rule eval", "detect", get_profile); @@ -275,6 +278,7 @@ static void register_profiles() RegisterProfile("eventq", nullptr, get_profile); RegisterProfile("total", nullptr, get_profile); RegisterProfile("daq meta", nullptr, get_profile); +#endif } //------------------------------------------------------------------------- @@ -323,9 +327,7 @@ static void SnortInit(int argc, char **argv) SnortConfig *sc; -#ifdef PERF_PROFILING register_profiles(); -#endif sc = ParseSnortConf(snort_cmd_line_conf->var_list); diff --git a/src/managers/module_manager.cc b/src/managers/module_manager.cc index 9a2f88543..6c49b2bc6 100644 --- a/src/managers/module_manager.cc +++ b/src/managers/module_manager.cc @@ -468,7 +468,9 @@ void ModuleManager::add_module(Module* m, const BaseApi* b) if ( mh->reg ) Shell::install(m->get_name(), mh->reg); +#ifdef PERF_PROFILING RegisterProfile(m); +#endif } Module* ModuleManager::get_module(const char* s) diff --git a/src/service_inspectors/ftp_telnet/ft_main.cc b/src/service_inspectors/ftp_telnet/ft_main.cc index be9694b0d..c539306c4 100644 --- a/src/service_inspectors/ftp_telnet/ft_main.cc +++ b/src/service_inspectors/ftp_telnet/ft_main.cc @@ -66,9 +66,9 @@ #include "mstring.h" #include "sfsnprintfappend.h" -static THREAD_LOCAL int ftppDetectCalled = 0; - #ifdef PERF_PROFILING +// FIXIT ftp, http, etc. should not be calling Detect() +static THREAD_LOCAL int ftppDetectCalled = 0; static THREAD_LOCAL ProfileStats ftppDetectPerfStats; void ft_update_perf(ProfileStats& stats) diff --git a/src/stream/tcp/ips_stream_reassemble.cc b/src/stream/tcp/ips_stream_reassemble.cc index 8e5751288..7ad033ab4 100644 --- a/src/stream/tcp/ips_stream_reassemble.cc +++ b/src/stream/tcp/ips_stream_reassemble.cc @@ -29,6 +29,7 @@ #include "framework/module.h" #include "framework/parameter.h" #include "detection/detect.h" +#include "detection/detection_defines.h" #include "hash/sfhashfcn.h" #include "time/profiler.h" diff --git a/src/stream/tcp/ips_stream_size.cc b/src/stream/tcp/ips_stream_size.cc index e24b2b0ec..d57afe086 100644 --- a/src/stream/tcp/ips_stream_size.cc +++ b/src/stream/tcp/ips_stream_size.cc @@ -29,6 +29,7 @@ #include "framework/module.h" #include "framework/parameter.h" #include "detection/detect.h" +#include "detection/detection_defines.h" #include "hash/sfhashfcn.h" #include "time/profiler.h" diff --git a/src/time/profiler.h b/src/time/profiler.h index 5163e749b..1aad31329 100644 --- a/src/time/profiler.h +++ b/src/time/profiler.h @@ -27,6 +27,17 @@ #include "config.h" #endif +#include "snort_types.h" + +// unconditionally declared +struct ProfileStats +{ + uint64_t ticks; + uint64_t ticks_start; + uint64_t checks; + uint64_t exits; +}; + #ifdef PERF_PROFILING #include "main/thread.h" #include "time/cpuclock.h" @@ -148,15 +159,6 @@ void ShowRuleProfiles(void); void ResetRuleProfiling(void); -/* Preprocessor stats info */ -struct ProfileStats -{ - uint64_t ticks; - uint64_t ticks_start; - uint64_t checks; - uint64_t exits; -}; - typedef struct _ProfileConfig { int num;