diff options
Diffstat (limited to 'src/pkt_seq_matcher_plugin.cpp')
| -rw-r--r-- | src/pkt_seq_matcher_plugin.cpp | 12 |
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) |
