将ragel库替换为6.10版本,7.0.0.10版本有bug会导致hyperscan加载utf-8规则失败

This commit is contained in:
root
2024-03-18 03:30:42 +00:00
parent c188261d78
commit 56fa98077b
4 changed files with 16 additions and 10 deletions

View File

@@ -72,12 +72,15 @@ static int pkt_seq_matcher_hyperscan_init(struct pkt_seq_matcher_plugin_info *ps
err = hs_compile_multi(expression, flags, ids, 6, HS_MODE_STREAM, NULL, &db, &compile_err);
if (err != HS_SUCCESS) {
printf("compile failed\n");
MESA_handle_runtime_log(g_logger_handle, RLOG_LV_FATAL, "PKT_SEQ_MATCHER", "compile failed: %d:%s, pattern:%s", compile_err->expression, compile_err->message, expression[compile_err->expression]);
hs_free_compile_error(compile_err);
return -1;
}
psm_plugin_info->hs_database = db;
MESA_handle_runtime_log(g_logger_handle, RLOG_LV_DEBUG, "PKT_SEQ_MATCHER", "hyperscan compile success");
return 0;
}
@@ -181,6 +184,10 @@ extern "C" void *pkt_seq_matcher_plugin_init(struct stellar *st)
goto ERROR;
}
if (pkt_seq_matcher_hyperscan_init(psm_plugin_info) != 0)
{
goto ERROR;
}
psm_plugin_info->plugin_id = stellar_plugin_register(st, (SESS_EV_TCP|SESS_EV_UDP|SESS_EV_OPENING|SESS_EV_PACKET|SESS_EV_CLOSING), pkt_seq_matcher_entry, psm_plugin_info);
@@ -192,8 +199,7 @@ ERROR:
free(psm_plugin_info);
}
perror("pkt_seq_matcher init failed");
exit(-1);
return NULL;
}
extern "C" void pkt_seq_matcher_plugin_exit(void *plugin_ctx)

14
vendor/CMakeLists.txt vendored
View File

@@ -16,14 +16,14 @@ ExternalProject_Add(colm PREFIX colm
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1)
# ragel-7.0.0.10
# ragel-6.10
ExternalProject_Add(ragel PREFIX ragel
URL ${CMAKE_CURRENT_SOURCE_DIR}/ragel-7.0.0.10.tar.gz
CONFIGURE_COMMAND ./autogen.sh && ./configure --prefix=${VENDOR_BUILD} --with-colm=${VENDOR_BUILD}
DEPENDS colm
BUILD_COMMAND make
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1)
URL ${CMAKE_CURRENT_SOURCE_DIR}/ragel-6.10.tar.gz
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${VENDOR_BUILD} --with-colm=${VENDOR_BUILD}
BUILD_COMMAND $(MAKE)
INSTALL_COMMAND $(MAKE) install
BUILD_IN_SOURCE 1
)
# HyperScan 5.4.2
ExternalProject_Add(hyperscan PREFIX hyperscan

BIN
vendor/ragel-6.10.tar.gz vendored Normal file

Binary file not shown.

Binary file not shown.