]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
more cmake and analyzer changes
authorRuss Combs <rucombs@cisco.com>
Tue, 7 Oct 2014 19:28:25 +0000 (15:28 -0400)
committerRuss Combs <rucombs@cisco.com>
Tue, 7 Oct 2014 19:28:25 +0000 (15:28 -0400)
ChangeLog
src/CMakeLists.txt
src/helpers/chunk.cc
src/main/shell.cc
src/managers/module_manager.cc
src/parser/mstring.cc
src/time/ppm.h
src/time/profiler.h

index 94ac4b497c81c392d52b503ef5c45214a14e4c4e..2eb50de079a809e50518d342703c600bdd384054 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@
 -- fixed some Xcode analyzer issues
 -- pulled in cmake updates from Josh
 -- pulled in nhttp updates from Tom
+-- applied cmake inc dir order patch from Josh
 
 122
 -- pulled thread pinning from Josh
index cffb22fed9bb0b8ba958a9a16b3aed2369b8c1c5..16beefc2110edd456d3377e2231aac5cc0dce513 100644 (file)
@@ -16,7 +16,6 @@ set(EXTERNAL_LIBRARIES
 )
 
 set(EXTERNAL_INCLUDES
-    ${LUAJIT_INCLUDE_DIR}
     ${DAQ_INCLUDE_DIR}
     ${PCAP_INCLUDE_DIR}
     ${PCRE_INCLUDE_DIR}
@@ -25,7 +24,8 @@ set(EXTERNAL_INCLUDES
     ${ZLIB_INCLUDE_DIRS}
     CACHE INTERNAL "external INCLUDES" FORCE
 )
-include_directories(BEFORE SYSTEM ${EXTERNAL_INCLUDES})
+include_directories(BEFORE ${LUAJIT_INCLUDE_DIR})
+include_directories(SYSTEM ${EXTERNAL_INCLUDES})
 
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
index c5bd83f390504763362c676289a7f6d3d06f1434..5d0e1758597ff6fdb43ae6955b08f7aeff7658ea 100644 (file)
 #include "chunk.h"
 
 #include <lua.hpp>
+extern "C"
+{
+    int lua_load(lua_State*, lua_Reader, void*, const char*);
+}
 
 #include "managers/ips_manager.h"
 #include "hash/sfhashfcn.h"
@@ -43,7 +47,7 @@ struct Loader
     bool done;
 };
 
-static const char* load(lua_State*, void* ud, size_t* size)
+static const char* ldchunk(lua_State*, void* ud, size_t* size)
 {
     Loader* ldr = (Loader*)ud;
 
@@ -66,7 +70,7 @@ void init_chunk(
     Loader ldr(chunk);
 
     // first load the chunk
-    if ( lua_load(L, load, &ldr, name) )
+    if ( lua_load(L, (lua_Reader)ldchunk, (void*)&ldr, name) )
     {
         ParseError("%s luajit failed to load chunk %s", name, lua_tostring(L, -1));
         return;
index daca3d2b803b245c6101b4dd6e29da179d4d67a3..e0d8cbb5bec57154e94963b83b0e86a64777e758 100644 (file)
@@ -159,7 +159,7 @@ void Shell::configure(SnortConfig* sc)
     loaded = true;
 }
 
-void Shell::install(const char* name, const luaL_reg* reg)
+void Shell::install(const char* name, const luaL_Reg* reg)
 {
     if ( !strcmp(name, "snort") )
         luaL_register(lua, "_G", reg);
index a5cb5d7e0375b4df98f6b1d91cb680a6b2067b86..36893378d2b67ae5305558c8b518a6b1c19a10e4 100644 (file)
@@ -47,7 +47,7 @@ struct ModHook
 {
     Module* mod;
     const BaseApi* api;
-    luaL_reg* reg;
+    luaL_Reg* reg;
 
     ModHook(Module*, const BaseApi*);
     ~ModHook();
@@ -100,10 +100,10 @@ void ModHook::init()
         n++;
 
     // constructing reg here may seem like overkill
-    // ... why not just typedef Command to luaL_reg?
+    // ... why not just typedef Command to luaL_Reg?
     // because the help would not be supplied or it
     // would be out of date, out of sync, etc. QED
-    reg = new luaL_reg[++n];
+    reg = new luaL_Reg[++n];
     unsigned k = 0;
 
     while ( k < n )
index bae27962fa3c028e5ba24c0c7fe8f7be239b63da..4bf98e86747e18e9e4376d9373937b2c80226422 100644 (file)
@@ -113,6 +113,7 @@ int main()
  *      array.
  *
  ****************************************************************/
+// FIXIT-L eliminate mSplit(); create iterator service if needed
 char ** mSplit(const char *str, const char *sep_chars, const int max_toks,
                int *num_toks, const char meta_char)
 {
index ebbcc65a3bad4453862b76b66c43209e4565e663..9e43bb21cbd1e44f508eef947f5aebb7b314718b 100644 (file)
@@ -139,10 +139,17 @@ extern THREAD_LOCAL int ppm_suspend_this_rule;
 #define PPM_PKT_CNT()             ppm_pt->pktcnt 
 #define PPM_PKT_LOG(p)            if (ppm_abort_this_pkt) ppm_pkt_log(&snort_conf->ppm_cfg,p)
 #define PPM_RULE_LOG(cnt,p)       ppm_rule_log(&snort_conf->ppm_cfg,cnt,p)
-#define PPM_ACCUM_PKT_TIME()      ppm_stats.tot_pkt_time += ppm_pt->tot;
+#define PPM_ACCUM_PKT_TIME() \
+if ( ppm_pt ) \
+{ \
+    ppm_stats.tot_pkt_time += ppm_pt->tot; \
+}
 #define PPM_ACCUM_RULE_TIME() \
-    ppm_stats.tot_rule_time += ppm_rt->tot; \
-    ppm_stats.tot_rules++;
+if ( ppm_rt ) \
+{ \
+        ppm_stats.tot_rule_time += ppm_rt->tot; \
+        ppm_stats.tot_rules++; \
+}
 #define PPM_ACCUM_NC_RULE_TIME() \
     ppm_stats.tot_nc_rule_time += ppm_rt->tot; \
     ppm_stats.tot_nc_rules++;
index 55ea3aa9c9a5cff5143a43c4393b0c2fd1524eb9..fd7c043b40d343cf13eea69fbeef4c0ead735710 100644 (file)
@@ -55,11 +55,6 @@ struct ProfileStats
 #define PROFILE_VARS_NAMED(name) uint64_t name##_ticks_start, name##_ticks_end
 #define PROFILE_VARS PROFILE_VARS_NAMED(snort)
 
-// we could use PROFILE_START_NAMED(node) instead
-// but that confuses static analysis
-#define PROFILE_START_NODE \
-    get_clockticks(node_ticks_start)
-
 #define PROFILE_START_NAMED(name) \
     get_clockticks(name##_ticks_start)
 
@@ -74,13 +69,14 @@ struct ProfileStats
 #define PROFILING_RULES ScProfileRules()
 #endif
 
-#define NODE_PROFILE_VARS uint64_t node_ticks_start, node_ticks_end, node_ticks_delta, node_deltas = 0
+#define NODE_PROFILE_VARS \
+    uint64_t node_ticks_start = 0, node_ticks_end, node_ticks_delta, node_deltas = 0
 
 #define NODE_PROFILE_START(node) \
     if (PROFILING_RULES) { \
         unsigned id = get_instance_id(); \
         node->state[id].checks++; \
-        PROFILE_START_NODE; \
+        PROFILE_START_NAMED(node); \
     }
 
 #define NODE_PROFILE_END_MATCH(node) \
@@ -101,7 +97,7 @@ struct ProfileStats
 
 #define NODE_PROFILE_TMPSTART(node) \
     if (PROFILING_RULES) { \
-        PROFILE_START_NODE; \
+        PROFILE_START_NAMED(node); \
     }
 
 #define NODE_PROFILE_TMPEND(node) \