[PATCH] Ipport plugin unit_test & statistics

This commit is contained in:
刘文坛
2023-10-07 09:48:26 +00:00
parent 00b2d2815d
commit 7cf9a79d64
11 changed files with 197033 additions and 34 deletions

View File

@@ -453,12 +453,12 @@ int maat_helper_verify_regex_expression(const char *regex_expr)
int maat_get_table_id(struct maat *maat_inst, const char *table_name)
{
int table_id = -1;
if (NULL == maat_inst || NULL == table_name) {
return -1;
}
struct table_manager *table_mgr = maat_inst->tbl_mgr;
table_id = table_manager_get_table_id(table_mgr, table_name);
return table_id;
return table_manager_get_table_id(table_mgr, table_name);
}
static inline void maat_runtime_ref_inc(struct maat_runtime *maat_rt, int thread_id)

View File

@@ -532,7 +532,12 @@ int ipport_plugin_runtime_commit(void *ipport_plugin_runtime, const char *table_
long long ipport_plugin_runtime_rule_count(void *ipport_plugin_runtime)
{
return 0;
if (NULL == ipport_plugin_runtime) {
return 0;
}
struct ipport_plugin_runtime *ipport_plugin_rt = (struct ipport_plugin_runtime *)ipport_plugin_runtime;
return ipport_plugin_rt->rule_num;
}
struct ex_data_runtime *ipport_plugin_runtime_get_ex_data_rt(void *ipport_plugin_runtime)
@@ -607,5 +612,10 @@ int ipport_plugin_runtime_get_ex_data(void *ipport_plugin_runtime, const struct
long long ipport_plugin_runtime_update_err_count(void *ipport_plugin_runtime)
{
return 0;
if (NULL == ipport_plugin_runtime) {
return 0;
}
struct ipport_plugin_runtime *ipport_plugin_rt = (struct ipport_plugin_runtime *)ipport_plugin_runtime;
return ipport_plugin_rt->update_err_cnt;
}