[PATCH]hyperscan version 5.4.0->5.4.2

This commit is contained in:
liuwentan
2023-06-12 18:22:01 +08:00
parent afd6102734
commit 8e882a8f72
7 changed files with 12 additions and 13 deletions

View File

@@ -27,7 +27,6 @@
#include "alignment.h" #include "alignment.h"
#define MODULE_COMPILE module_name_str("maat.compile") #define MODULE_COMPILE module_name_str("maat.compile")
#define MAX_TABLE_LINE_SIZE (1024 * 16)
struct compile_schema { struct compile_schema {
int compile_id_column; int compile_id_column;
@@ -139,7 +138,7 @@ struct compile_sort_para {
#define MAAT_COMPILE_MAGIC 0x4a5b6c7d #define MAAT_COMPILE_MAGIC 0x4a5b6c7d
struct maat_compile { struct maat_compile {
uint32_t magic; uint32_t magic_num;
int actual_clause_num; int actual_clause_num;
int declared_clause_num; int declared_clause_num;
int not_clause_cnt; int not_clause_cnt;
@@ -178,7 +177,7 @@ struct maat_compile *maat_compile_new(long long compile_id)
{ {
struct maat_compile *compile = ALLOC(struct maat_compile, 1); struct maat_compile *compile = ALLOC(struct maat_compile, 1);
compile->magic = MAAT_COMPILE_MAGIC; compile->magic_num = MAAT_COMPILE_MAGIC;
compile->compile_id = compile_id; compile->compile_id = compile_id;
for(int i = 0; i < MAX_ITEMS_PER_BOOL_EXPR; i++) { for(int i = 0; i < MAX_ITEMS_PER_BOOL_EXPR; i++) {
@@ -225,7 +224,7 @@ void maat_compile_free(struct maat_compile *compile)
clause_state->in_use = 0; clause_state->in_use = 0;
} }
compile->magic = 0; compile->magic_num = 0;
FREE(compile); FREE(compile);
} }
@@ -1156,7 +1155,7 @@ size_t maat_compile_bool_matcher_match(struct compile_runtime *compile_rt, int i
expr_match, MAX_SCANNER_HIT_COMPILE_NUM); expr_match, MAX_SCANNER_HIT_COMPILE_NUM);
for (int i = 0; i < bool_match_ret && ud_result_cnt < ud_array_size; i++) { for (int i = 0; i < bool_match_ret && ud_result_cnt < ud_array_size; i++) {
compile = (struct maat_compile *)expr_match[i].user_tag; compile = (struct maat_compile *)expr_match[i].user_tag;
assert(compile->magic == MAAT_COMPILE_MAGIC); assert(compile->magic_num == MAAT_COMPILE_MAGIC);
assert((unsigned long long)compile->compile_id == expr_match[i].expr_id); assert((unsigned long long)compile->compile_id == expr_match[i].expr_id);
if (0 == compile->actual_clause_num) { if (0 == compile->actual_clause_num) {
continue; continue;
@@ -1259,7 +1258,7 @@ struct maat_compile *maat_compile_clone(struct maat_compile *compile, int deep_c
{ {
struct maat_compile *new_compile = ALLOC(struct maat_compile, 1); struct maat_compile *new_compile = ALLOC(struct maat_compile, 1);
new_compile->magic = compile->magic; new_compile->magic_num = compile->magic_num;
new_compile->compile_id = compile->compile_id; new_compile->compile_id = compile->compile_id;
new_compile->actual_clause_num = compile->actual_clause_num; new_compile->actual_clause_num = compile->actual_clause_num;
new_compile->declared_clause_num = compile->declared_clause_num; new_compile->declared_clause_num = compile->declared_clause_num;
@@ -1586,7 +1585,7 @@ size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt, int thr
MAX_SCANNER_HIT_COMPILE_NUM); MAX_SCANNER_HIT_COMPILE_NUM);
for (int idx = 0; idx < bool_match_ret; idx++) { for (int idx = 0; idx < bool_match_ret; idx++) {
compile = (struct maat_compile *)expr_match[idx].user_tag; compile = (struct maat_compile *)expr_match[idx].user_tag;
assert(compile->magic == MAAT_COMPILE_MAGIC); assert(compile->magic_num == MAAT_COMPILE_MAGIC);
assert((unsigned long long)compile->compile_id == expr_match[idx].expr_id); assert((unsigned long long)compile->compile_id == expr_match[idx].expr_id);
if (0 == compile->actual_clause_num || NULL == compile->user_data) { if (0 == compile->actual_clause_num || NULL == compile->user_data) {
continue; continue;

View File

@@ -70,7 +70,7 @@ struct expr_item {
struct expr_runtime { struct expr_runtime {
struct adapter_hs *hs; struct adapter_hs *hs;
struct rcu_hash_table *item_hash; // store hs_expr rule for rebuild adapter_hs instance struct rcu_hash_table *item_hash; // <item_id, struct expr_item>
long long version; //expr_rt version long long version; //expr_rt version
long long rule_num; long long rule_num;

View File

@@ -46,7 +46,7 @@ struct flag_item {
struct flag_runtime { struct flag_runtime {
struct flag_matcher *matcher; struct flag_matcher *matcher;
struct rcu_hash_table *item_hash; struct rcu_hash_table *item_hash; // <item_id, struct flag_item>
long long rule_num; long long rule_num;
long long version; long long version;

View File

@@ -43,7 +43,7 @@ struct interval_item {
struct interval_runtime { struct interval_runtime {
struct interval_matcher *matcher; struct interval_matcher *matcher;
struct rcu_hash_table *item_hash; //store interval rule for rebuild interval_matcher instance struct rcu_hash_table *item_hash; // <item_id, struct interval_item>
long long version; long long version;
long long rule_num; long long rule_num;

View File

@@ -67,7 +67,7 @@ struct ip_item {
struct ip_runtime { struct ip_runtime {
struct ip_matcher *ip_matcher; struct ip_matcher *ip_matcher;
struct interval_matcher *intval_matcher; struct interval_matcher *intval_matcher;
struct rcu_hash_table *item_hash; struct rcu_hash_table *item_hash; // <item_id, struct ip_item>
long long version; long long version;
long long rule_num; long long rule_num;

View File

@@ -39,9 +39,9 @@ ExternalProject_Add(ragel PREFIX ragel
INSTALL_COMMAND make install INSTALL_COMMAND make install
BUILD_IN_SOURCE 1) BUILD_IN_SOURCE 1)
# HyperScan 5.4.0 # HyperScan 5.4.2
ExternalProject_Add(hyperscan PREFIX hyperscan ExternalProject_Add(hyperscan PREFIX hyperscan
URL ${CMAKE_CURRENT_SOURCE_DIR}/hyperscan-5.4.0.tar.gz URL ${CMAKE_CURRENT_SOURCE_DIR}/hyperscan-5.4.2.tar.gz
DEPENDS ragel DEPENDS ragel
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${VENDOR_BUILD} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC") CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${VENDOR_BUILD} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC")