summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorroot <[email protected]>2024-03-18 03:30:42 +0000
committerroot <[email protected]>2024-03-18 03:30:42 +0000
commit56fa98077b2f11d1398d7728a85be52a51026253 (patch)
tree1f567b1cfe46e63ee29c20849e28515ef8fd7b61 /src
parentc188261d78362f3fef755b5136eaf1ff0dfdbf82 (diff)
将ragel库替换为6.10版本,7.0.0.10版本有bug会导致hyperscan加载utf-8规则失败
Diffstat (limited to 'src')
-rw-r--r--src/pkt_seq_matcher_plugin.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/pkt_seq_matcher_plugin.cpp b/src/pkt_seq_matcher_plugin.cpp
index 637a5d9..cde629d 100644
--- a/src/pkt_seq_matcher_plugin.cpp
+++ b/src/pkt_seq_matcher_plugin.cpp
@@ -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)