]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
cmake support for hyperscan
authorruss <russ@localhost.localdomain>
Fri, 30 Oct 2015 15:21:19 +0000 (11:21 -0400)
committerruss <russ@localhost.localdomain>
Fri, 30 Oct 2015 15:21:19 +0000 (11:21 -0400)
12 files changed:
cmake/FindHS.cmake [new file with mode: 0644]
cmake/configure_options.cmake
cmake/include_libraries.cmake
cmake/sanity_checks.cmake
config.cmake.h.in
doc/bugs.txt
doc/start.txt
src/CMakeLists.txt
src/ips_options/CMakeLists.txt
src/ips_options/Makefile.am
src/ips_options/test/CMakeLists.txt [new file with mode: 0644]
src/ips_options/test/ips_regex_test.cc

diff --git a/cmake/FindHS.cmake b/cmake/FindHS.cmake
new file mode 100644 (file)
index 0000000..e0e21f5
--- /dev/null
@@ -0,0 +1,11 @@
+
+find_path (HS_INCLUDE_DIR NAMES hs/hs_compile.h)
+
+find_library(HS_LIBRARIES NAMES hs)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(HS REQUIRED_VARS HS_INCLUDE_DIR HS_LIBRARIES)
+
+mark_as_advanced(HS_INCLUDE_DIR HS_LIBRARIES)
+
+
index 88ef1c3d24da47c3c3029e46fc350e49406d4c83..43953efd8826b7a5b8966d5244d815212ff99142 100644 (file)
@@ -39,7 +39,6 @@ set_if_true (BUILD_UNIT_TESTS UNIT_TEST)
 set_if_true (BUILD_PIGLET PIGLET)
 set_if_true (ENABLE_PROFILE PROFILE)
 set_if_true (ENABLE_SHELL BUILD_SHELL)
-
 set_if_true (BUILD_PIGLET PIGLET)
 set_if_true (STATIC_PIGLETS STATIC_PIGLETS)
 
index e9ad1b0a1f80d322cb51efc8a3405c637f446d38..a6ffe788304b2e5a6fc9421a1c352e28fc8761be 100644 (file)
@@ -9,9 +9,10 @@ find_package(PCRE REQUIRED)
 find_package(ZLIB REQUIRED)
 
 # optional libraries
-find_package(LibHS QUIET)
 find_package(LibLZMA QUIET)
 find_package(OpenSSL QUIET)
 find_package(Asciidoc QUIET)
 find_package(DBLATEX QUIET)
 find_package(Ruby QUIET 1.8.7)
+find_package(HS QUIET)
+
index c11f7cee2941250c43b2e552d1c8bab045adcff8..3424375915bd279dfe3fa9ecf027797ce50e8b83 100644 (file)
@@ -189,8 +189,8 @@ if (DEFINED OPENSSL_CRYPTO_LIBRARIES)
     check_library_exists (${OPENSSL_CRYPTO_LIBRARIES} MD5_Init "" HAVE_OPENSSL_MD5)
 endif()
 
-if (DEFINED LIBHS_LIBRARIES)
-    check_library_exists (${LIBHS_LIBRARIES} hs_scan "" HAVE_HYPERSCAN)
+if (DEFINED HS_LIBRARIES)
+    check_library_exists (${HS_LIBRARIES} hs_scan "" HAVE_HYPERSCAN)
 endif()
 
 if (DEFINED LIBLZMA_LIBRARIES)
index 83bdf298d9a11d09672a76ce8a17c2286882fa36..d8abe906f68b844ec690ae0a958d7ff10e18ea9d 100644 (file)
 
 #cmakedefine HAVE_OPENSSL_MD5 1
 
+/* hyperscan available */
+#cmakedefine HAVE_HYPERSCAN 1
+
 /* lzma available */
 #cmakedefine HAVE_LZMA 1
 
index 3220e9a63a12dcb7ad473d5b2c225e6b468cb5b9..2cafc9301ac2c602468283a69975a8fc5626c327 100644 (file)
@@ -19,6 +19,9 @@
 * Enabling debug messages may erroneously affect the number of packets
   processed from pcaps
 
+* It is not possible to build unit tests w/o static plugins.
+
+
 ==== Config
 
 * Parsing issue with IP lists.  can't parse rules with $EXTERNAL_NET
index 28f1b2aeb30458b222640e4f9dfb91ef3dbabc9d..af5038c523a569abdb595c06b4b9292f8c4cae99 100644 (file)
@@ -19,7 +19,7 @@ Required:
 
 * pcre from http://www.pcre.org for regular expression pattern matching
 
-* zlib from http://www.zlib.net for decompression
+* zlib >= 1.2.8 from http://www.zlib.net for decompression
 
 * pkgconfig from http://www.freedesktop.org to build the example plugins
 
index 0d2f4c1368596f68788d448e071ae1f553d5f6bb..bdcc9635790236279882e444f644ef46b8798562 100644 (file)
@@ -1,27 +1,29 @@
 
 # keeping track of external libraries seperately for use in pkg-config.
 set(EXTERNAL_LIBRARIES
-    ${LUAJIT_LIBRARIES}
-    ${PCRE_LIBRARIES}
-    ${PCAP_LIBRARIES}
-    ${OPENSSL_LIBRARIES}
-    ${LIBLZMA_LIBRARIES}
-    ${ZLIB_LIBRARIES}
-#    ${OPENSSL_CRYPTO_LIBRARY}  -- part of OPENSSL_LIBRARIES
     ${DAQ_LIBRARIES}
     ${DNET_LIBRARIES}
     ${CLANG_CXX_LIBRARY}
-    ${CMAKE_THREAD_LIBS_INIT} # GCC says we must link to the threads library
     ${CMAKE_DL_LIBS}
+    ${CMAKE_THREAD_LIBS_INIT} # GCC says we must link to the threads library
+    ${HS_LIBRARIES}
+    ${LIBLZMA_LIBRARIES}
+    ${LUAJIT_LIBRARIES}
+    ${OPENSSL_LIBRARIES}
+#    ${OPENSSL_CRYPTO_LIBRARY}  -- part of OPENSSL_LIBRARIES
+    ${PCAP_LIBRARIES}
+    ${PCRE_LIBRARIES}
+    ${ZLIB_LIBRARIES}
     CACHE INTERNAL "external libraries" FORCE
 )
 
 set(EXTERNAL_INCLUDES
     ${DAQ_INCLUDE_DIR}
-    ${PCAP_INCLUDE_DIR}
-    ${PCRE_INCLUDE_DIR}
     ${DNET_INCLUDE_DIR}
+    ${HS_INCLUDE_DIR}
     ${OPENSSL_INCLUDE_DIR}
+    ${PCAP_INCLUDE_DIR}
+    ${PCRE_INCLUDE_DIR}
     ${ZLIB_INCLUDE_DIRS}
     CACHE INTERNAL "external INCLUDES" FORCE
 )
index a7a88dcda0461ae7cf1cc451f90cfbdb17d55701..4d25d2be74e976915ec31c50caf3f6d453b23293 100644 (file)
@@ -72,7 +72,7 @@ set (IPS_SOURCES
 
 if ( HAVE_HYPERSCAN )
     set(OPTION_LIST ips_regex.cc ips_regex.h)
-endif
+endif ()
 
 if (STATIC_IPS_OPTIONS)
 
index 8067c449ff82c20d2d889b8ec8ee06626ef370f3..9a0d7326918674c8a5755732eeebedc8e764ca0a 100644 (file)
@@ -200,13 +200,6 @@ libips_raw_data_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
 libips_raw_data_la_LDFLAGS = -export-dynamic -shared
 libips_raw_data_la_SOURCES = ips_raw_data.cc
 
-if HAVE_HYPERSCAN
-optlib_LTLIBRARIES += libips_regex.la
-libips_regex_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
-libips_regex_la_LDFLAGS = -export-dynamic -shared
-libips_regex_la_SOURCES = ips_regex.cc
-endif
-
 optlib_LTLIBRARIES += libips_rem.la
 libips_rem_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
 libips_rem_la_LDFLAGS = -export-dynamic -shared
diff --git a/src/ips_options/test/CMakeLists.txt b/src/ips_options/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c910d2f
--- /dev/null
@@ -0,0 +1,9 @@
+
+add_cpputest(ips_regex_test ips_options
+    ips_options
+    framework
+    sfip
+    catch_tests
+    hs
+)
+
index 9a9f9616e95346c2337fde4b3f5272d5b03bf74c..bf9a97fb9ab736b4e9b3bdb1ceae1845d5e2c08f 100644 (file)
@@ -240,6 +240,7 @@ TEST_GROUP(ips_regex_option)
         IpsApi* api = (IpsApi*)ips_regex;
         api->dtor(opt);
         regex_cleanup(snort_conf);
+        api->pterm(snort_conf);
     }
 };
 
@@ -276,6 +277,7 @@ TEST(ips_regex_option, match_absolute)
     Cursor c(&pkt);
     CHECK(opt->eval(c, &pkt) == DETECTION_OPTION_MATCH);
     CHECK(!strcmp((char*)c.start(), " stew *"));
+    CHECK(opt->retry());
 }
 
 TEST(ips_regex_option, no_match_delta)
@@ -322,6 +324,7 @@ TEST(ips_regex_option_relative, no_match)
 
     CHECK(opt->is_relative());
     CHECK(opt->eval(c, &pkt) == DETECTION_OPTION_NO_MATCH);
+    CHECK(!opt->retry());
 }
 
 //-------------------------------------------------------------------------